ClassicPress / classic-commerce

A simple but powerful e-commerce platform built for ClassicPress. Forked from WooCommerce and compatible with many Woo extensions.
https://classiccommerce.cc/
GNU General Public License v3.0
54 stars 15 forks source link

Problem in WC_AJAX::add_to_cart() #318

Closed magenta-cuda closed 3 years ago

magenta-cuda commented 3 years ago

https://github.com/ClassicPress-plugins/classic-commerce/blob/10650f8347d4307b8b02ccdc76195e544cb50e51/includes/class-wc-ajax.php#L391

if "false !== WC()->cart->add_to_cart(...)" then the product has been added to the cart including persistence to the database however if "'publish' !== $product_status" then all subsequent execution including the response sent to the frontend of the program will be as if add to the cart operation has failed. The critical point is if "false !== WC()->cart->add_to_cart(..)" then the add to cart has succeeded and nothing should override this.