how can i add an additional action into woocommerce admin order page through my plugin?

You can use this code to add an action on the admin order page: const CUSTOM_ACTION_CODE = “my-plugin__custom-action-code”; add_filter(“woocommerce_order_actions”, function ($actions) { $actions[CUSTOM_ACTION_CODE] = “label of the custom action”; return $actions; }); add_action(“woocommerce_order_action_” . CUSTOM_ACTION_CODE, function (\WC_Order $order) { // here the code of the treatement of $order //… });

Can’t Change WooCommerce Default Language to Spanish (Mexico)

Oh god…I just tried to “Update Translations” and now it just magically works…so frustrating… So if this happens to anyone, you don’t need to download anything…just set your language in wordpress under General, go to the Updates section and at the bottom you will see language updates. Update those files and the WooCommerce language files … Read more

Block Disposable Emails on Woocommerce Registration

Hi just add this code in your theme functions.php add_action(‘init’, ‘mydomain_plugin_checks’); function mydomain_plugin_checks(){ if ( class_exists(‘BanHammer’) ) { add_filter(‘woocommerce_registration_errors’, ‘woocommerce_banhammer_validation’, 10, 3 ); } } function woocommerce_banhammer_validation( $validation_errors, $username, $email ) { if( (new BanHammer)->banhammer_drop( $username, $email, $validation_errors ) ) return new WP_Error( ‘registration-error-bad-email’, (new BanHammer)->options[‘message’] ); return $validation_errors; }

Conditional logic – if product has a parent category, echo this

There are two files that WooCommerce pulls from to create a product page: single-product.php and content-single-product.php. Single-product.php determines what information is displayed on the page and creates the layout that will display the information. You can view its content here. Content-single-product.php pulls the content of the product that’s been organized into hooks with actions and … Read more

Custom rewrite for product variation not working

This works because on this URL, $_REQUEST[‘attribute_pa_model’] is set, and in this example, the value is iphone-x: index.php?product=example&attribute_pa_model=iphone-x But on this URL, $_REQUEST[‘attribute_pa_model’] is not set, so the auto-selection of the product variation does not work: /product/example/iphone-x So on that URL, you can use the woocommerce_dropdown_variation_attribute_options_args to filter the selected value, like so: add_filter( ‘woocommerce_dropdown_variation_attribute_options_args’, … Read more