Plugin Author
Jonas
(@flinnn)
Hi mizou,
thanks for reaching out.
I’ve just added the filter ‘anonymous_donation_checkbox_location’ that allows you so adjust the location: https://github.com/wc-donation/wc-donation-platform/commit/89d2ebb8d1119bc53a48b7a2afeece162c7f3ebd
Your script could look like this:
add_filter('anonymous_donation_checkbox_location', function() {
return 'woocommerce_after_order_notes';
});
This feature will be included in the next version of the plugin: https://www.wc-donation.com/documentation/support/installing-the-latest-development-version/
Best,
Jonas
Thread Starter
mizou
(@mizou)
I have just updated the plugin which contains the updated script and added the script to my theme functions, but it is not working / running? I did some debug logging but the filter is not running. Any idea what is going wrong?
P.s. I saw you added plugin option to redirect to cart instead checkout, perfect!
Plugin Author
Jonas
(@flinnn)
Hi mizou,
so you are still seeing the checkbox at the woocommerce_review_order_before_submit location?
Best,
Jonas
Thread Starter
mizou
(@mizou)
Yes it is still at the same location. Added the code:
// Change location of the checkbox
add_filter('anonymous_donation_checkbox_location', function() {
return 'woocommerce_after_order_notes';
});
Add checked if the following code was available in my plugin version
if (get_option("wcdp_enable_checkout_checkbox", "no") === "yes") {
// Add checkbox to WooCommerce checkout
$checkbox_location = apply_filters('anonymous_donation_checkbox_location', 'woocommerce_review_order_before_submit');
add_action($checkbox_location, array($this, 'add_anonymous_donation_checkbox'));
//Save the value of the WooCommerce checkout checkbox
add_action('woocommerce_checkout_create_order', array($this, 'save_anonymous_donation_checkbox'));
//Display the value of the WooCommerce checkout checkbox to the user
add_action('woocommerce_order_details_after_customer_details', array($this, 'display_anonymous_donation_checkbox_in_order_details'));
}