walkinverse
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Current Release 3.4.5 BREAKS Coupons@rynald0s No worries 🙂
I actually fired up a docker instance and started to var_dump and print_r to trace it and make sure I wasn’t missing something. It is definitely in the foreach. It is exiting without first checking all the items in the cart.
Thank you again and you are more than welcome!
Forum: Plugins
In reply to: [WooCommerce] Current Release 3.4.5 BREAKS Coupons@rynald0s The issue is with the foreach as you are not checking the next. As soon as you see an item on sale you are exiting the code (BREAK). That is a bug in the logic. What needs to happen is to check all the items in the cart before breaking out because you never get to the second item if the first hit in the loop is flagged as a sale item. Hence, this is a bug.
/** * Ensure coupon is valid for sale items in the list is valid or throw exception. * * @since 3.2.0 * @throws Exception Error message. * @param WC_Coupon $coupon Coupon data. * @return bool */ protected function validate_coupon_sale_items( $coupon ) { if ( $coupon->get_exclude_sale_items() && 'fixed_product' !== $coupon->get_discount_type() ) { $valid = true; foreach ( $this->get_items_to_validate() as $item ) { <strong>if ( $item->product && $item->product->is_on_sale() )</strong> { $valid = false; break; } } if ( ! $valid ) { throw new Exception( __( 'Sorry, this coupon is not valid for sale items.', 'woocommerce' ), 110 ); } } return true; }- This reply was modified 7 years, 8 months ago by walkinverse.
Forum: Plugins
In reply to: [WooCommerce] Current Release 3.4.5 BREAKS Coupons@rynald0s One more note here is a video screencast of the what is happening. It looks like it should not behave this way.
https://www.dropbox.com/s/vikywyz8945z804/Recording%20%2332.mp4?dl=0
You said you fixed this: Coupon validation changes #21219 But it is not fixed as you cannot apply a coupon to this change. Please watch the screencast. What am I missing?
- This reply was modified 7 years, 8 months ago by walkinverse.
Forum: Plugins
In reply to: [WooCommerce] Current Release 3.4.5 BREAKS Coupons@rynald0s I am curious, how is it suppose to work? If a customer wants to buy two items. One item is on sale, and one item is not, and they add both to the cart shouldn’t the one that is not on sale take the discount when you set the coupon to only be able to be used on items that are not on sale?
Shouldn’t the nonsale item get the 20% discount? Currently, if any item that is on sale in the cart with a non-sale item, the coupon is automatically removed and cannot be used.
How can I test this fix? Will an update be available as 3.4.6?
Thank you for your response.
- This reply was modified 7 years, 8 months ago by walkinverse.
Forum: Plugins
In reply to: [WooCommerce] Product Image@jdembowski I would have but I was not able to access the previous post or I would have. I also explained that in detail in the second post. It would be nice if the system would email you a link to the post so you could go directly to it. After I logged the issue I closed the browser and could not get back, hence the second post to let you know I rolled back and if developers went to look at the screen they would not see the issue except for in the screen capture in the link provided on dropbox. Next time I will bookmark it. Thanks.
Forum: Plugins
In reply to: [WooCommerce] Product ImageI had to use wp rollback to roll back to the previous version of 3.3.1 unfortunately.