• Hello

    I need help adding a new shortcode to my current snapcode.

    I’m using the WooCommerce Email Customizer plugin.
    I want to add a shortcode to show the order item detail.

    I attach a screenshot:

    The current snapcode I`m using is:

    <?php
    /**
    * Custom code shortcode
    *
    * @var $order WooCommerce order
    * @var $email_id WooCommerce email id (new_order, cancelled_order)
    * @var $sent_to_admin WooCommerce email send to admin
    * @var $plain_text WooCommerce email format
    * @var $email WooCommerce email object
    * @var $attr array custom code attributes
    */

    if ( ! defined( 'ABSPATH' ) ) {
    exit;
    }

    if ( isset($attr['type']) && $attr['type'] == 'pre-order-link' ) {
    printf(
    __( "%sצפייה בהזמנה%s", 'wc-pre-orders' ),
    '<a href="' . $order->get_view_order_url() . '">',
    '</a>'
    );
    }

    if(isset($attr['type']) && $attr['type'] == 'pre-order-qty'){
    $order_items = $order->get_items();
    foreach ($order_items as $item ) {
    printf( __( "%s%s", 'wc-pre-orders' ), '<b>' . $order->get_item_count() . '', '</b>' );
    }
    }

    if(isset($attr['type']) && $attr['type'] == 'pre-order-item'){
    $order_items = $order->get_items();
    foreach ($order_items as $item ) {
    printf( __( "%s%s", 'wc-pre-orders' ), '<b> ' . $item->get_name() . '', '</b>' );
    }
    }

    I need to add to the snapcode a new code for the “item detail”

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Shortcode ( item description ) in email template’ is closed to new replies.