Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Free product choice in combination with Advanced Dynamic Pricing For Woocommerc › Reply To: Free product choice in combination with Advanced Dynamic Pricing For Woocommerc

#15529
Soft79
Keymaster

Replace the snippet with:


/**
 * Fix for advanced pricing rules plugin, which empties and recreates the cart when a rule applies
 */
add_action( 'init', function() {
	if ( ! is_callable( 'WJECF' ) ) return;
	if ( $plugin = WJECF()->get_plugin('pro-free-products') ) {
		remove_action( 'woocommerce_cart_emptied', array( $plugin, 'woocommerce_cart_emptied' ) );
	}
	if ( $plugin = WJECF()->get_plugin('autocoupon') ) {
		remove_action( 'woocommerce_cart_emptied', array( $plugin, 'action_cart_emptied' ), 10, 0 );
	}
}, 20);

This snippet disables actions of our plugin that are performed when the cart gets emptied. By default our plugin must forget coupon info when the cart is emptied.

Can you show me how/where the product gets a price? I see this: https://imgur.com/NvFHARL