Forum Replies Created
-
AuthorPosts
-
jazzynlParticipant
Hello, i send you an e-mail.
The The combination of cxecrt and apply_coupon worked.Does the cxecrt plugin allow to include a coupon in the cart?
yes
jazzynlParticipantHello Soft79.
I think i found the problem with an PHP error creating plugin.
In the server PHP logs, the plugin created errors so i disabled the plugin.
I keep this post updated.(and hope the errors are gone now)jazzynlParticipantPRO version in combination with the snippet is working well.
Maybe it is an feature in an next update so that you can select it.– product A gives €5 discount, but it will be only there if product B an/or C are in the basket with minimum of 3.
Thanks for support.
jazzynlParticipantThe version of Extended Coupon Features is: 2.6.0.2
the debus shows no errors:
(just a part of it)
2018-01-13T21:02:28+00:00 DEBUG woocommerce_after_calculate_totals WJECF_AutoCoupon::get_all_auto_coupons Autocoupons:
2018-01-13T21:02:28+00:00 DEBUG woocommerce_after_calculate_totals WJECF_AutoCoupon::update_matched_autocoupons Auto coupons that should be in cart:
2018-01-13T21:02:28+00:00 DEBUG woocommerce_after_calculate_totals WJECF_AutoCoupon::update_matched_autocoupons Coupons in cart: earlybirdI have a fatal error log:
2018-01-13T20:14:42+00:00 CRITICAL Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /****/public_html/wp-includes/class-wp-hook.php on line 286 and exactly 2 expected in /****/public_html/wp-content/themes/****/functions.php:152
Stack trace:
#0 /****/public_html/wp-includes/class-wp-hook.php(286): {closure}(Object(WC_Coupon))
#1 /****/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array)
#2 /****/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /****//public_html/wp-content/plugins/woocommerce-auto-added-coupons/includes/WJECF_Controller.php(463): do_action(‘wjecf_assert_co…’, Object(WC_Coupon))
#4 /****/public_html/wp-includes/class-wp-hook.php(286): WJECF_Controller->assert_coupon_is_valid(true, Object(WC_Coupon), Object(WC_Discounts))
#5 /your help is greatly appreciated! Sorry for the problem.
jazzynlParticipantPHP-versie: 7.1.12
jazzynlParticipantHi Soft79, thanks for the fast response!
The problem when i add the code to the functions.php i get an: HTTP ERROR 500 error.
Is there a fault in the code?add_action( 'wjecf_assert_coupon_is_valid', function( $coupon, $wc_discounts ) { if ( strtolower( WJECF_Wrap( $coupon )->get_code() ) == strtolower( 'earlybird' ) ) { //Must have at least 3 items in the cart $items = WJECF_WC()->get_discount_items( $wc_discounts ); $qty = 0; foreach( $items as $item_key => $item ) { if ( $item->product === false ) continue; $qty += $item->quantity; if ($qty >= 3) return; } throw new Exception( WC_Coupon::E_WC_COUPON_NOT_APPLICABLE ); } }, 10, 2 );
jazzynlParticipantOk, this is working in a price value!
The problem is, i want to add 5€ on 1 product but the costumer must have 3 products in total in the basket.
How can i achief that? The products have not all the same price.
When i not excluse the products, then the €5 will added on the wrong product combination. -
AuthorPosts