add seperate suffix for low price and high price in woocommerce

You cloud use the filter “woocommerce_format_price_range” from the “wc_format_price_range” function to modifed the price. A small example: function my_function_to_change_the_price_formating($price) { // If you look in the function wc_format_price_range, you will see that the two prices are separated by a dash. (–) // We used this “dash” and separate the two prices. $tmp = explode(‘–’, $price); … 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

WP All Import / Update stock quantity from multiple XML files

I managed to get it working, here is answer: – when importing update new stock to custom field: _custom_stock_placeholder – update only this field: _custom_stock_placeholder – add this code to functions.php add_action(‘pmxi_saved_post’, ‘post_saved’, 10, 1); function post_saved($id) { $original_stock = get_post_meta($id, ‘_stock’, true); $new_stock = get_post_meta($id, ‘_custom_stock_placeholder’, true); $combined_stock= $original_stock + $new_stock; update_post_meta($id, ‘_stock’, $combined_stock); … Read more