• Resolved alexssdb

    (@alexssdb)


    Hello,

    Is it possible to modify the available stock notification template and add the product photo?

    Thank you,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter alexssdb

    (@alexssdb)

    Solved

    Modify the template in the directory:
    wp-content/plugins/woocommerce-product-stock-alert/templates/emails/stock_alert_email.php

    Add on line 25:
    $product_image = $product_obj-> get_image(array (300, 300));

    Add on line 55:

    <div>
        <a href="<?php echo $product_link; ?> "> <? php echo $product_image; ?> </a>
    </div>

    In this way, when the stock notification email arrives available to the customer, you can see the product photo in the email and access it by clicking on the image.

    • This reply was modified 5 years, 4 months ago by alexssdb.
    • This reply was modified 5 years, 4 months ago by alexssdb.

    Hi!

    I tried the code you provided. Unfortunately it is not working ??

    I am looking at changing this section of the code:

    <h3><?php _e( ‘Product Details’, ‘woocommerce-product-stock-alert’ ); ?></h3>
    <table cellspacing=”0″ cellpadding=”6″ style=”width: 100%; border: 1px solid #eee;” border=”1″ bordercolor=”#eee”>
    <thead>
    <tr>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( ‘Product’, ‘woocommerce-product-stock-alert’ ); ?></th>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( ‘Price’, ‘woocommerce-product-stock-alert’ ); ?></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( $product_obj->get_name(), ‘woocommerce-product-stock-alert’ ); ?>
    <?php if($product_obj->get_type() == ‘variation’){
    foreach ($product_obj->get_attributes() as $label => $value) {
    echo “<br>”.ucfirst(wc_attribute_label($label)).”: “.ucfirst($value).”“;
    }
    } ?></th>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( $product_price, ‘woocommerce-product-stock-alert’ ); echo ( isset( $is_prices_including_tax ) && ($is_prices_including_tax != “yes” )) ? WC()->countries->ex_tax_or_vat() : WC()->countries->inc_tax_or_vat(); ?></th>
    </tr>
    </tbody>
    </table>

    <p style=”margin-top: 15px !important;”><?php printf( __( “Following is the product link : “, ‘woocommerce-product-stock-alert’ ) ); ?>“><?php echo $product_name; ?></p>

    Would it be possible to display only the first product image on the left side, the product title + price on the right side of the image and a “Buy now” button?

    I would be thankful for any reply on this.

    xx

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add product image to email’ is closed to new replies.