Forum Replies Created
-
AuthorPosts
-
Soft79Keymaster
2.5.2.2 should work fine with your PHP version.
Soft79KeymasterYes, this can be done using the following snippet in functions.php.
But:
– The snippet does not respect the tax display settings of WooCommerce
– The subtotal below the cart will still display the undiscounted subtotaladd_filter( 'woocommerce_cart_item_subtotal', function( $price, $values ) { if ( ! isset( $values['line_subtotal'], $values['line_total'] ) ) return $price; $regular_price = $values['line_subtotal'] + $values['line_subtotal_tax']; $sale_price = $values['line_total'] + $values['line_tax']; $price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>'; return $price; }, 10, 2);
Soft79KeymasterNot out of the box.
If the user is logged in, then it’s not too difficult to create a custom script for it. Otherwise it will be more difficult.
Soft79KeymasterYes, you’re right I didn’t notice it. Fixed it in 2.5.2.2.
Soft79KeymasterHi Szilvia,
currently it’s not on the roadmap, but if you’re PHP savvy, it’s quite easy to create a plugin yourself, please have a look at the example at https://www.soft79.nl/documentation/wjecf/#!/api.
Soft79KeymasterHi Bas,
I see what you mean. Please upgrade to 2.5.2.1 which fixes the issue.
Hi Bas,can you please explain me the problem you were having?Soft79KeymasterI just released v2.5.2. Is the problem solved in 2.5.2?
Soft79KeymasterI just updated the documentation.
https://www.soft79.nl/documentation/wjecf/#!/api
It’s still a work in progress, but it covers most.
Soft79KeymasterHi Eugeneus,
Yes, you’re right the documentation still has to be written….
In a nutshell:
- The API functions are in the file WJECF_Pro_API.php, and examples on how to use them are in wjecf-pro-api-example.php
- If you would like to build your own extra functionality for this plugin, hook into the
wjecf_init_plugins
-action. Then create a class that extendsAbstract_WJECF_Plugin
and load it by callingWJECF()->add_plugin( 'NameOfYourClass');
- Create a function init_hook(), where you setup your plugin and define frontend hooks.
- Create a function init_admin_hook(), where you setup your plugin for admin usage and define admin hooks.
- If you would like to add admin fields, you can use the WooCommerce functions (like
woocommerce_wp_text_input
) for that, for example by hooking into thewoocommerce_coupon_options_usage_restriction
action, you can add fields to the Usage Restrictions tab. Or use one of these actions for my plugin:wjecf_coupon_metabox_checkout
,wjecf_coupon_metabox_customer
,wjecf_coupon_metabox_misc
,wjecf_coupon_metabox_free_products
. - For version 2.5.1+ create a function admin_coupon_meta_fields( $coupon ), and make it return an array
[ 'field_name' => 'sanitation', ... ]
. Upon saving a coupon, these fields will be automatically read from $_POST and sanitized with the given sanition method, e.g.'int'
,'int[]'
,'yesno'
,'decimal'
,'clean'
or even a callback:[ 'callback' => callback ]
and saved to the current coupon. For versions prior to 2.5.1, you need to handle process_shop_coupon_meta yourself.
- These are currently the available filters:
apply_filters( 'wjecf_bogo_product_amount_for_coupon', $qty, $coupon )
apply_filters( 'wjecf_set_free_product_amount_in_cart', $quantity, $product )
apply_filters( 'wjecf_free_product_amount_for_coupon', $coupon_qty, $coupon )
apply_filters( 'wjecf_free_cart_item_price', __('Free!', 'woocommerce'), $price_html, $cart_item, $cart_item_key )
apply_filters( 'wjecf_free_cart_item_subtotal', __('Free!', 'woocommerce'), $price_html, $cart_item, $cart_item_key )
apply_filters( 'wjecf_coupon_can_be_applied', $can_be_applied, $coupon )
apply_filters( 'wjecf_coupon_has_a_value', $has_a_value, $coupon )
If you have any questions, just let me know.
Soft79KeymasterAre coupons enabled in WooCommerce?
WooCommerce > Settings > Checkout > Enable the use of Coupons
Soft79KeymasterMaoz,
please download version 2.5.1-b5 from your account page and let me know if that version works for you.
(I’ve tested that version with PHP 5.3 and PHP 7.0 in combination with WooCommerce 2.6 and 3.0)
Soft79KeymasterPlease consult your hosting provider. I will try to make the next release compatible with outdated php versions, but it will take a couple of days.
Soft79KeymasterHi,
Can you upgrade your PHP to 5.5 or newer?
Soft79KeymasterHi Fredy,
In the current version you can’t yet enter the licence key. This will be added in a later version, and it will allow for automatic updates. You’ll be notified when this version is released.
May 19, 2017 at 10:40 pm in reply to: I'd like the coupon to apply to samples, even when other products are in my cart #1379Soft79KeymasterYes, I’ve received it. I’ll get back to you.
-
AuthorPosts