If you’re running a WooCommerce Shop and like to send your latest products to your audience you can use Mailster with the WooCommerce Add on.

Since WooCommerce products are custom post types you can create any auto responder campaign and use your products.

Static Content

Enable “Products” on the static page of in the editbar and you will get all public products in reverse chronological order.

You’ll get your product instantly in your campaign:

Dynamic Content

Select the “dynamic” tab and “Products” from the drop down. You can limit your results by categories (taxonomies).

A dynamic Module uses the placeholders like {product_title:-1} to get the latest post title. Read more about tags here.

Adding Meta data

You can also include meta data to your content with the {product_meta[XXX]} tag.

Display the price of the item

Use {product_meta[_regular_price]:-1}

Display the sales price of the item

Use {product_meta[_sale_price]:-1}

Formatting the output

Since WooCommerce stores the meta data without formatting and you would rather see “$ 9,99” instead of “9.99” you have to add some custom filters to your site:

add_filter( 'mailster_replace_product_meta', function( $replace_to, $post, $meta_field ) {

    if ( '_regular_price' == $meta_field || '_sales_price' == $meta_field ) {
        $replace_to = '$ ' . number_format_i18n( $replace_to, 2 );
    }

    return $replace_to;
}, 10, 3 );

Read more on how to add custom code to your web site here.

Tagged: