Shortcode ( item description ) in email template

  • Unknown's avatar

    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”

  • Hi there! What is the site you are referring to? It appears that you don’t have any WordPress.com sites that can install plugins.

    If your site is hosted outside of WordPress.com, it’s a self-hosted site, which means you will want to check in this forum https://wordpress.org/support/forums/

    You can learn more about the differences between WordPress.com and WordPress.org here: 
    https://support.wordpress.com/com-vs-org/
    https://wordpress.com/dailypost/2013/11/14/com-or-org/

  • Unknown's avatar

    Thank you for your advice :)

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