echo product parent category
echo product parent category
echo product parent category
Using a clean wordpress install, woocommerce and storefront theme, I came up with this code. It sorts regular products and variable products only. Only sorts in admin panel. Sorts by weight from hgih to low (you can see the commented section, you can uncomment the relevant option to you). The code goes into functions.php add_filter(‘woocommerce_order_get_items’, … Read more
There is an issue with the latest version of WPML that causes this problem. WPML has a quick fix for this: https://wpml.org/errata/endpoints-containing-slashes-are-incorrectly-encoded/
Put this below code in functions.php and Try it. add_action( ‘woocommerce_before_single_product’, ‘content_before_addtocart_button’ ); function content_before_addtocart_button() { global $post; $categories = array(); $taxonomies = get_terms( array( ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => false, ‘parent’ => 0 )); if ( !empty($taxonomies) ) : foreach( $taxonomies as $taxonomy ) { $categories[] = $taxonomy->slug; } endif; $terms = get_the_terms( $post->ID, … Read more
I am having errors with checkout on wordpress
There is a solution for this. Manually create the long name attribute in “Product Attributes” page, and use a short slug name here. In the product import section there is no “attribute slug” in the Column Headers(Or maybe there is one but not used by WooCommerce by default). Like so Then you can import from … Read more
In order to achive that you only need two woocommerce filters. First we remove the email post field from the checkout form. Second we set the the submited form data, email, to some fixed value. This is the whole code, paste it into functions.php and you are good to go. Don’t forget to change the … Read more
You can use Woo-commerce option to select default variation in front-end. Please see attached file:
You should call wp_localize_script() in the wp_enqueue_scripts hook (or a later hook) in which you would get the correct product/post data such as ID, and that conditional tags like is_single() would also work as expected. So you should move all the $product, $product_id, $dataToBePassed and wp_localize_script() parts to inside the wp_enqueue_scripts callback, and then you’d … Read more
The second part of the problem is solved by putting this code into theme’s functions.php file : // First name as default display name add_action( ‘profile_update’, ‘set_display_name’, 10 ); function set_display_name( $user_id ) { $data = get_userdata( $user_id ); if($data->first_name) { remove_action( ‘profile_update’, ‘set_display_name’, 10 ); // profile_update is called by wp_update_user, so we need … Read more