woocommerce – How to Include “product short description” into new order emails only for admin?

I am trying to display product short description in the new order email received by admin.

I have tried to add the below in to email-order-items.php but still no luck.

can you please advise is the code correct or am i just placing it incorrectly.

echo ‘
‘ . $_product->post->post_excerpt;

Thanks,
Meher

WooCommerce 4: Gallery size is too large in mobile

I’m working on my custom theme, and try to fit Bootstrap grid layout into the product page. The product page looks fine in the desktop version, but the product image looks very big in mobile version. Please see this link:

Rose Quartz Generator

Can you please advise? Thanks!

I want to show either the WooCommerce Price OR the WooCommerce Bookings Price in a Divi module

I am using WooCommerce combined with WooCommerce Bookings.

We have two types of product, bookable products and nonbookable products. I would like to show the price for the product on the page within a Divi module. We are using Divi to completely style the page of the Divi product so I cannot use an override like I ususally would.

Is there a way to add some PHP code to the functions file then call it as a shortcode in a Divi module?

I tried adding this code to my functions.php within my child theme but when I call it it errors and won’t save the page.

functions.php

function woo_price_and_bookings_price ($atts)
{
    global $product;
    $product_id = $product->get_id();
    wc_get_product($product_id);
    echo '<h1>The price is: ' . $product->get_price_html() . '</h1>';
}
add_shortcode( 'price_and_bookings_price', 'woo_price_and_bookings_price' );

shortcode I am calling

(price_and_bookings_price)

The price does not appear, but my text does. However my text appears at the very top of the page and not in the position I have assigned it in Divi. The page also errors on save and seems to automatically open a new page whenever I do this.

The page that opens contains nothing except my code (twice for some reason):

The price is:

What am I doing wrong and is this the right way to approach this task? I need to use Divi as I have inherited the site and we are not using traditional product pages.

hooks – How to display two different custom taxonomy terms on a WooCommerce single product page

Our WooCommerce products have two custom taxonomies: sizes and colors.

I’m trying to display the custom toxonomy terms for a product on its single product page. I’m using the woocommerce_single_product_summary action hook. I can’t get both taxonomies to display at the same time.

Here’s my code so far:

<?php
/**
 * display a woocommerce product's custom taxonomy terms on single product pages
 */

function display_single_product_sizes_after_summary() { 
    global $post;
    
    $size_terms = get_the_terms( $post->ID , array( 'sizes') );
    // begin creating html markup
    $size_markup = '';
    if(!empty($size_terms)) {
        $size_markup .= "<p>Similar size shades: ";
    }
    // init counter
    $is = 1;
    foreach ( $size_terms as $size_term ) {
        $size_markup .= '<a href="/shades/size/' . $size_term->slug . '">' . $size_term->name . '</a>';
        //  Add comma (except after the last item)
        $size_markup .= ($is < count($size_terms))? ", " : "";
        // Increment counter
        $is++;
        //finish the markup
        if(!empty($size_terms)) {
            $size_markup .= "</p>";
        }
    }
    echo $size_markup;
};

function display_single_product_colors_after_summary() { 
    global $post;
    
    $color_terms = get_the_terms( $post->ID , array( 'colors') );
    // begin creating html markup
    $color_markup = '';
    if(!empty($color_terms)) {
        $color_markup .= "<p>Similar color shades: ";
    }
    // init counter
    $ic = 1;
    foreach ( $color_terms as $color_term ) {
        $color_markup .= '<a href="/shades/color/' . $color_term->slug . '">' . $color_term->name . '</a>';
        //  Add comma (except after the last item)
        $color_markup .= ($ic < count($color_terms))? ", " : "";
        // Increment counter
        $ic++;
        //finish the markup
        if(!empty($color_terms)) {
            $color_markup .= "</p>";
        }
    }
    echo $color_markup;
};

function display_single_product_terms_after_summary() {
    display_single_product_sizes_after_summary();
    display_single_product_colors_after_summary();
};
add_action( 'woocommerce_single_product_summary', 'display_single_product_terms_after_summary', 101, 0 );
?>

This outputs the following:

Similar size shades: Small

Similar color shades:

If I reverse the order of the two sub-functions in display_single_product_traits_after_summary the output changes to:

Similar color shades: Blue

Similar size shades:

I’ve tried to use a reset at the end of each subfunction. I’ve tried:

    echo $size_markup;
    wp_reset_postdata();

and:

    echo $color_markup;
    wp_reset_postdata();

This makes no difference.

I’ve also tried:

    echo $size_markup;
    rewind_posts();

and:

    echo $color_markup;
    rewind_posts();

This breaks the page altogether.

What is my mistake here, and how can I get the terms from both taxonomies to display?

Buying – WordPress WooCommerce site

Hi
I need a WordPress WooCommerce site built for ecommerce.
SEMrush

The primary product on the site will be POD items. The site needs to be connected to both printful and printify.

I have the domain, logo and customer images that can be used on the site. Everything else i’m flexible on (themes, layout etc)

Please PM me your portfolio and prices

Thanks

 

woocommerce – Is it possible to checkout with 2 different shipping options on a single order?

This is regarding a marketplace in WooCommerce that has different vendors. Let’s say you are buying item A from Vendor 1 and item B from Vendor 2. And you would like to get the first item shipped to your home, but you want to pick up Item B, since it’s close to your home. Is it possible to checkout on a single order choosing a shipping method for item A and a different one for item B?

Thanks!

unable to copy WooCommerce checkout state field values from billing to shipping, or vice versa

I’m trying to modify the WooCommerce checkout display so that:

  1. Both field columns are open and expanded
  2. There is a checkbox under shipping address, which upon clicking, copies data over from the billing fields to the shipping fields.

I’ve got that part set up, but though the state data is copied over from one area to another, upon trying to place order, the error message of “Shipping State is a required field.
No shipping method has been selected.” is displayed.

I’m presuming that the data upon manually using the state select field is being recorded somewhere other than the DOM, which is why it’s not working?

Here’s my jQuery code that’s doing the copying:

<script type="text/javascript">
$("#ship-to-billing-address-checkbox").on("click", function(){
    // if (this.checked) {
        $("(name='shipping_first_name')").val($("(name='billing_first_name')").val());
        $("(name='shipping_last_name')").val($("(name='billing_last_name')").val());
        $("(name='shipping_address_1')").val($("(name='billing_address_1')").val());
        $("(name='shipping_address_2')").val($("(name='billing_address_2')").val());
        $("(name='shipping_city')").val($("(name='billing_city')").val());
        $("(id='select2-shipping_state-container')").text($("(id='select2-billing_state-container')").text());
        $("(name='shipping_postcode')").val($("(name='billing_postcode')").val());
        $("(name='shipping_country')").val($("(name='billing_country')").val());
});

If you want to see it in action, go to https://stage.chilwellness.com/checkout/?add-to-cart=12105. Enter your info in billing, click the checkbox, then you’ll see that though the state field seems entered, the label is still the color red, indicating that it’s needing data still.

woocommerce – Formatting product prices in email orders

I’m trying to format prices in case of Indian Rupees. Below is my code and it works in case of email order on hold but how to make it work in case of order-complete?

   //Indian Currency Formatter
add_filter( 'formatted_woocommerce_price','ind_currency_formatter', 100, 1 );

    function ind_currency_formatter($price){
        global $user_currency;
        if($user_currency=='inr'||$user_currency=='INR'){
            $price = preg_replace("/(d+?)(?=(dd)+(d)(?!d))(.d+)?/i", "$1,", str_replace( ',', '', $price ));
            return $price;
        }
        else{
            return $price;
        }
    }

css – Trying to style Woocommerce sidebar Cart Widget

I have looked at length to find CSS that will change the background color, border radius and product info text color. I think this may not be a “mini cart”. The price of the item, subtotal and View Cart / Checkout buttons follow the styling Ive done to the cart. I have successfully changed my product text color on my actual Cart page. So frustrating! Help is much appreciated.

woocommerce – How do I execute code when user makes first purchase?

Here is my code so far:

function send_message_to_new_member( $user_id) {

    if ( ! bp_is_active( 'messages' ) )
        return;

    $args = array(
        'sender_id' => 1,
        'thread_id' => false,
        'recipients' => $user_id,
        'subject' => 'First Purchase',
        'content' => 'Hello - congrats on your purchase!',
        'date_sent' => bp_core_current_time()
    );

    $result = messages_new_message( $args );
}
add_action( 'woocommerce_order_status_completed', 'send_message_to_new_member', 3 );

I am trying to send users an automated message in buddypress after their first woocommerce purchase. I’m a bit lost on where to go from here. Any help is greatly appreciated – thanks!