Tag Info

Hot answers tagged

4

I know this post is old, but to keep this question updated: As of WooCommerce 2.4.4 woocommerce_process_product_meta_variable no longer works, and it must be changed to woocommerce_save_product_variation So, Change: add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 ); Into: add_action( ...


2

There is almost never a scenario where executing PHP code entered from the wysiwyg editor is a good idea. It opens up a whole bunch of security issues. The best way to achieve what you are looking for is to setup a custom short code that will return the link you are interested in. Add something like this to your functions.php file in your theme. ...


1

Orders are just regular posts: wp_delete_post($order_id,true);


1

I solve This To get the current category ID. $cate = get_queried_object(); $cateID = $cate->term_id; echo $cateID; and it works like a charm.


1

WordPress default importer will not work for WooCommerce product attributes. There is a plugin available to import WooCommerce products which handles import for products as well as their attributes. I'll not paste the plugin URL here since it's a third party plugin, but if you google for 'WooCommerce import', you will easily get that plugin.


1

Turns out it was the WooCommerce Jetpack Plugin all along. Stupid thing had something enabled which it didn't need. I guess that's what I get if I let a client access the plugin menu. Thank you, denis.stoyanov, for helping me find the solution!


1

get_terms() accept an array of arguments as second parameter. One of those parameters are include include (integer) An array of term ids to include. Empty returns all. You already have your selected term ids in an array, so just simply pass them to the include parameter in the array of arguments in get_terms() $terms = get_terms( $taxonomy, ...


1

You could try adding some css to your theme's style.css file: .onsale { display: none !important; } If you're using a pre-built theme, it's wise to do this in a child theme's style.css, as the change won't be overwritten if you update your theme. Further reading: https://codex.wordpress.org/Child_Themes


1

You can use the WordPress function is_user_logged_in() to check that, and create some basic if statements to show and hide the appropriate code.


1

It seems that the OP have managed to solve his/her problem by doing this, which can be found at Different menus for logged-in users. if ( is_user_logged_in() ) { wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) ); } else { wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) ); } The more shorter way to achieve that is by ...


1

Product category is just a regular wordpress taxonomy. You can get the link like this: echo esc_url( get_term_link( 6, 'product_cat' ) ); You can use slugs too: echo esc_url( get_term_link( 'category-slug', 'product_cat' ) );


1

This is what I have used to create a custom order status called "Invoiced". Add this to your theme's functions.php // New order status AFTER woo 2.2 add_action( 'init', 'register_my_new_order_statuses' ); function register_my_new_order_statuses() { register_post_status( 'wc-invoiced', array( 'label' => _x( 'Invoiced', ...



Only top voted, non community-wiki answers of a minimum length are eligible