Add multiple shipping rates from add_rate function with custom ID

to understand how to store choosen method id or else try using: // Make a shipping rate for each result foreach ($quote->shipping_options as $option) { $rate = array( ‘id’ => ‘my_method_’.$option->id, ‘label’ => $methodNames[$option->name], ‘cost’ => $option->price, ‘meta_data’ => array(), ); // Register the rate $this->add_rate($rate); } in ‘meta_data’ you can store whatever you wantin … Read more

How can i run the same WordPress install on multiple subdomains?

WP multisite (subdomain) is the answer – http://codex.wordpress.org/Create_A_Network In addition you can install the WP Domain Mapping Plugin to run on other domains You need to decide whether you want WP multisite subdomain or sub-directory installation. WP subdomain does exactly what you want, but WP subdir + domain mapping plugin allows you to have both … Read more

WooCommerce New customer email Hook? [closed]

There is no actions/filters to hook to. You need to override standard WC_Email_Customer_New_Account class and implement your own logic. To do it you need to create your own class which will inherit that class and register it. class WPSE8170_Email_Customer_New_Account extends WC_Email_Customer_New_Account { function trigger( $user_id, $user_pass=””, $password_generated = false ) { // do what you … Read more

Exclude Empty Child Categories in Menu

I would go about this slightly differently. Still using the wp_get_nav_menu_items filter, but first I’ll build an array containing the IDs of all empty terms. Then I’ll compare each of the $items to this for potential exclusion: add_filter( ‘wp_get_nav_menu_items’, ‘wpse177082’, 10, 3 ); function wpse177082 ( $items, $menu, $args ) { global $wpdb; $empty = … Read more

WooCommerce Link to Product Category

For this purpose there is get_term_link function (documentation). <a href=”https://wordpress.stackexchange.com/questions/199226/<?php echo get_term_link( 42 ,”product_cat’) ?>”>Fine Art … etc.</a> Product category is just WP taxonomy, so there is plenty of functions to work with. In this case you have to know your product category ID (taxonomy term ID, actually). When editing category, you will find it … Read more

Filtering search results

You may need to include a tax_query for the Woocommerce taxonomy (called ‘product_cat’): $tax_query = array( array( ‘taxonomy’ => ‘product_cat’ ), ); $query->set( ‘tax_query’, $tax_query ); } return $query; } However, you’ll have to ensure that you can return posts AND pages AND product categories and also note the search results will be mixed up … Read more

Remove action from woocommerce barcode plugin [closed]

You need to access the class variable to remove a action which has been added within a class function remove_default_order_barcode(){ global $WooCommerce_Order_Barcodes ; remove_action( ‘woocommerce_order_details_after_order_table’, array( $WooCommerce_Order_Barcodes, ‘get_display_barcode’ ), 1, 1 ); } add_action(‘init’,’remove_default_order_barcode’); hope it will help you !

Writing Clean WooCommerce Styles

What i do is, disable Woocommerce default styles depending on what i want to customize, instead of overwriting the css. Woocommerce loads 3 styles by default: woocommerce-general.css woocommerce-layout.css woocommerce-smallscreen.css If you want to fully customize you can disable all styles or, just the ones that you dont want by adding: // Remove each style one … Read more

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