WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?

How to use the filter single_product_archive_thumbnail_size I’ve searched for the tag single_product_archive_thumbnail_size in woocommerce repository on github. There is only the single occurrence of it as you see here. So how do we use it? The author’s of WooCommerce added this filter so that other developers would be able to modify the product’s archive thumbnail … Read more

Adding Custom Text Area to WooCommerce Product

There is a display bug in WooCommerce when displaying a WYSIWYG editor on admin product pages inside any “product data” setting tabs. Try it: // Display a custom field in product admin pages add_action( ‘woocommerce_product_options_general_product_data’, ‘add_product_custom_wysiwyg_field’ ); function add_product_custom_wysiwyg_field() { global $product_object; echo ‘<div class=”product_custom_field”> <p>’ . __( “Mer information” ) . ‘</p> <div style=”padding:9px;”>’; … Read more

How to remove recurring totals information for a particular subscription product? [closed]

Try filtering the hook woocommerce_cart_calculate_fees. Use this code. it might work for you. add_filter( ‘woocommerce_cart_calculate_fees’, ‘add_recurring_postage_fees’, 10, 1 ); function add_recurring_postage_fees( $cart ) { if ( ! empty( $cart->recurring_cart_key ) ) { remove_action( ‘woocommerce_cart_totals_after_order_total’, array( ‘WC_Subscriptions_Cart’, ‘display_recurring_totals’ ), 10 ); remove_action( ‘woocommerce_review_order_after_order_total’, array( ‘WC_Subscriptions_Cart’, ‘display_recurring_totals’ ), 10 ); } }

Remove commas from WooCommerce checkout addresses fields

You can remove/replace comas from address_1 and address_2 billing and shipping fields with the following, once order is submitted (before saving data): // Checkout/Order: Remove/replace comas from adresses fields add_action(‘woocommerce_checkout_create_order’, ‘remove_comas_from_address_fields’, 10, 2 ); function remove_comas_from_address_fields( $order, $data ) { $replacement=””; if ( $billing_address_1 = $order->get_billing_address_1() ) { $order->set_billing_address_1( str_replace( ‘,’, $replacement, $billing_address_1 ) ); … Read more

Replace existing content from specific WooCommerce admin orders list column

The correct filter hook to be used is manage_edit-shop_order_columns. 1) To remove shipping_address column: add_filter( ‘manage_edit-shop_order_columns’, ‘remove_specific_orders_column’ ); function remove_specific_orders_column( $columns ){ unset( $columns[‘shipping_address’] ); return $new_columns; } Code goes in functions.php file of the active child theme (or active theme). Tested and works. 2) Replace the content of shipping_address column: Here is an example … Read more

How to order posts (woocommerce products) alphabetically but ignore certain words, eg ‘The’ and ‘An’

Ok, worked it out via a little workaround. Add a new sorting function in Woocommerce, something like: https://gist.githubusercontent.com/bekarice/0df2b2d54d6ac8076f84/raw/wc-sort-by-postmeta.php works nicely, but remove the bit about meta values and keys since we’re not sorting by custom fields (though that could be a good workaround too). Change the orderby to be ‘name’. Eg post slug rather than … Read more

Migrate WooCommerce Orders [closed]

The reason copying those messed up your site was probably because of id mismatches. That is, posts with the ids of the stuff you’re importing already exists. Regardless, since woocommerce stores orders as a custom post type, your safest bet here is probably the built in wordpress post import/export tool. 1. In the wordpress backend … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)