woocommerce

Display description before the title in WooCommerce product category archives

你离开我真会死。 提交于 2021-02-19 08:50:53
问题 In WooCommerce, I am trying to display the description before the title in Product category archive pages. But I fail trying to find out what hooks could I use to do it. The idea was to have a "Flavour Menu" be displayed first, and then the title afterwards, like in this screenshot: Any track is appreciated. 回答1: You will need to override the template templates/archive-product.php located in the Woocommerce plugin, copying it to your active theme folder to a woocommerce subfolder (but not in

Getting all product ids of woocommerce categories

痴心易碎 提交于 2021-02-19 08:16:13
问题 I am trying to get all product ids using product_cat here is my code function get_products_from_category_by_ID( $category ) { $products_IDs = new WP_Query( array( 'post_type' => 'product', 'post_status' => 'publish', 'fields' => 'ids', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $category, ) ), ) ); return $products_IDs; } var_dump( get_products_from_category_by_ID( 196 ) ); But getting WP_Query objects instead of ids of

Hiding products without thumbnail in WooCommerce shop page

不问归期 提交于 2021-02-19 08:13:07
问题 I use importer which imports thousands of products to the shop. Although I must insert picture and description for the product before I want to sell the item. I would like to hide product from the store at all IF there is no thumbnail image assigned. This way new products appear to the shop only after I have set the thumbnail image. I tried this in header.php, but did not work: <?php if($_product->getImage() && $_product->getImage() != 'no_selection'){ ?> <style> /* Css to hide Featured image

display product attribute and taxonomy in woocommerce product page

隐身守侯 提交于 2021-02-19 07:33:13
问题 I want to display the Brand attribute from the Additional Info on the product page. Is there a way to create a shortcode because i have a specific location to display it or even in php. This is for woocommerce 3.6.5 Thank you in advance 回答1: You can add the follows code snippet in your active theme's functions.php to do the above - // to display product additional info in product page add_action( 'woocommerce_single_product_summary', 'show_additional_info_product_summary', 45 ); // To diplay

Display a payment link for custom order statuses in Woocommerce email notifications

旧街凉风 提交于 2021-02-19 07:30:26
问题 I've been struggling for a while to get this to work. I need to show this payment link in my woocommerce emails, but only on certain (custom) order statuses. How is it done? Thanks :) printf( wp_kses( /* translators: %1s item is the name of the site, %2s is a html link */ __( '%2$s', 'woocommerce' ), array( 'a' => array( 'href' => array(), ), ) ), esc_html( get_bloginfo( 'name', 'display' ) ), '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Click here to pay

Woocommerce Change shipping method title on checkout based on shipping class selected

懵懂的女人 提交于 2021-02-19 06:52:04
问题 I want to change the shipping method title displayed in the checkout of my store based on the shipping class the product has. e.g. Shipping method title is currently Flat Rate and I have 2 products: If product A is being purchased I need it to have "Fragile shipping" If product B is being purchased I need it to have "Standard shipping" Sadly I have to do my shipping using classes so alternative methods won't work. Any help would be appreciated. 回答1: The following code will rename your

Change Related Products Heading adding the product name in WooCommerce

自闭症网瘾萝莉.ら 提交于 2021-02-19 06:48:04
问题 I have this code which is an attempt in translating "Related products" into "These will go well with PRODUCT NAME". Here's my code: add_filter( 'gettext', 'change_related_products_title', 10, 3 ); function change_related_products_title( $translated, $text, $domain ) { $ptitle = get_page_by_title( 'Product Title', OBJECT, 'product' ); if( $text === 'Related products' && $domain === 'woocommerce' ){ $translated = esc_html__( 'These go well with '.$ptitle.' ', $domain); } return $translated; }

Can't remove WooCommerce's image zoom

泄露秘密 提交于 2021-02-19 06:12:45
问题 I am trying to remove the image zoom from my custom themed website which uses WooCommerce. Here is what I've tried adding in my functions.php file: add_action( 'after_setup_theme', 'remove_pgz_theme_support', 100 ); function remove_pgz_theme_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } and this add_action( 'wp', 'remove_pgz_theme_support', 20 ); function remove_pgz_theme_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } I've spend some time googling but the

Can't remove WooCommerce's image zoom

你。 提交于 2021-02-19 06:11:24
问题 I am trying to remove the image zoom from my custom themed website which uses WooCommerce. Here is what I've tried adding in my functions.php file: add_action( 'after_setup_theme', 'remove_pgz_theme_support', 100 ); function remove_pgz_theme_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } and this add_action( 'wp', 'remove_pgz_theme_support', 20 ); function remove_pgz_theme_support() { remove_theme_support( 'wc-product-gallery-zoom' ); } I've spend some time googling but the

Set all shipping methods cost to zero for a Free shipping coupon in Woocommerce

故事扮演 提交于 2021-02-19 05:31:19
问题 I have 3 shipping methods in my cart that should become zero prices as soon as your customer enters Free Shipping coupon. I know how to add a filter in functions.php to detect the coupon but is someone know a snippet to set shipping methods visibles in cart (radio button) to ZERO for this order? My deliveries methods are companies like UPS, FedEx... I activated the free shipping option in order it can be managed with coupon. The list of choice of deliveries methods for the customers is