How to get current product category ID in product archive page
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.
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.
For that, you do not need to modify the woocommerce/templates/myaccount/navigation.php. The best way to customize the “My Account” navigation menu items is to use: woocommerce_account_menu_items filter hook to add new items to the menu. array_slice() to reorder them the way you want. This way, by using woocommerce_account_menu_items filter hook, you integrate perfectly your own items … Read more
<?php $product_id = ’14’; $product = new WC_product($product_id); $attachment_ids = $product->get_gallery_image_ids(); foreach( $attachment_ids as $attachment_id ) { // Display the image URL echo $Original_image_url = wp_get_attachment_url( $attachment_id ); // Display Image instead of URL echo wp_get_attachment_image($attachment_id, ‘full’); }?>
I finally tried using var_dump() on $item and $_product, which are both used in the email-order-items.php template. $_product revealed a post object, which itself has a post_excerpt property, which looks like it holds the contents of the “Product Short Description” from the WooCommerce product form. So, to add the description beneath the item name, I … Read more
For serious reference, see how WC itself adds the textarea variable_description to the variations here. We notice multiple (potential) problems in your text field implementation. The missing name… The id string does not have a correct structure, it has the name structure instead… The id or name are not same than in your template… So … Read more
Have you made sure to copy the mini-cart.php into yourtheme/woocommerce/cart/ not just yourtheme/woocommerce I can say for certain this works in Woocommerce version 2.0.12 Also if your saying that editing the core file isn’t working is it possible that its getting override some where else in your theme. Could be worth searching your theme directory … Read more
The WooCommerce template files are different from the WordPress Template files look at this to see how it works and the template file for shop pages is archive-product.php Usually, all themes provide a separate sidebar area for the shop page, did you check if your theme is compatible with WooCommerce? If yes then you should … Read more
Here is the result that works, I put in the condition : is_product() to check if is a single product page. And I changed in the add_action() : admin_init by wp function cm_redirect_users_by_role() { $current_user = wp_get_current_user(); $role_name = $current_user->roles[0]; if ( is_product() ){ if ( $role_name !== ‘customer’ && $role_name !== ‘shop_manager’ && $role_name … Read more
You could check to see if the ‘WooCommerce’ class exists, then run the code that requires WooCommerce. <?php if ( class_exists( ‘WooCommerce’ ) ) { // code that requires WooCommerce } else { // you don’t appear to have WooCommerce activated } ?>
You can try this $mailer = WC()->mailer(); $mails = $mailer->get_emails(); if ( ! empty( $mails ) ) { foreach ( $mails as $mail ) { if ( $mail->id == ‘customer_completed_order’ ) { $mail->trigger( $order->id ); } } }