YayMail - WooCommerce Email Customizer
  • Getting Started
    • Introduction
    • How to Install
    • Enter license key
    • System Requirements
    • How To Update YayMail
    • Uninstall and Delete
  • Overview
    • Email Templates
    • Global Header and Footer
    • Settings
    • Addon
    • Preview Email
  • Drag-and-Drop Email Builder
    • The Elements Panel
      • Basic Elements
        • Embed a YayMail shortcode into a button
        • Add HTML and shortcode
        • Duplicate/Copy an Element
      • General Elements
      • WooCommerce Elements
        • Change Order Item Titles
      • Blocks
    • The Patterns Panel
      • Header
      • Footer
      • Banner
      • Pre-Designed Patterns
    • The Settings Panel
      • Global Settings
        • Customize with CSS
        • Hide Elements of Order Table
      • Email Settings
    • History
    • Upper Toolbar
      • Shortcodes
      • Custom shortcode
      • Reset Templates
      • Import/copy template from
  • Visibility Control
  • Guides
    • Display coupons
    • Add column in order item table
  • Developer zone
    • API Demo Plugin
    • Register Templates
      • Register new template
      • Email class
      • Render Templates content
    • Register Elements
      • Register New Elements
      • Element Class
      • Render Element content
      • Default element data
      • Custom Property Editor (coming soon)
    • Register Shortcodes
      • Register New Shortcodes
      • Shortcode Class
    • Custom Hook
  • Integrations
    • Advanced Custom Fields (ACF) by WP Engine
    • Advanced Local Pickup for WooCommerce by Zorem
    • Back In Stock Notifier by codewoogeek
    • Checkout Field Editor by ThemeHigh
    • Checkout Field Editor by WooCommerce
    • Custom Order Status by Nuggethon
    • Custom Order Status by TycheSoftwares
    • Custom Order Status Manager for WooCommerce by Bright Plugins
    • Flexible Checkout Fields by WPDesk
    • FooEvents for WooCommerce
    • Shipment Tracking
    • Software Addon by WooCommerce
    • WooCommerce Admin Custom Order Fields by SkyVerge
    • WooCommerce Order Status Manager by SkyVerge
    • WooCommerce Show Attributes by Isabel Castillo
    • WPML & WooCommerce Multilingual
    • Weglot Translate
    • Loco Translate
    • TranslatePress/Polylang
    • Translate text in YayMail
    • User meta
  • Addons
    • Conditional Logic
    • WooCommerce Subscriptions
    • Germanized for WooCommerce
    • Dokan Multi Vendor
    • AutomateWoo
    • WooCommerce Follow Ups
    • WooCommerce Bookings
    • WooCommerce Gift Cards
    • Smart Coupons
    • WooCommerce Memberships and Teams for WooCommerce Memberships
    • WooCommerce Pre-Orders
    • Parcel Panel Order Tracking
    • WCFM Marketplace
    • Affiliate For WooCommerce
    • Back In Stock Notifications
    • PW WooCommerce Gift Cards
    • Appointments for WooCommerce
    • WooCommerce Bookings And Appointments by PluginHive
    • B2BKing
    • B2B Market
    • B2B & Wholesale Suite
    • TrackShip for WooCommerce
    • SG WooCommerce Order Approval
    • SUMO Subscriptions
    • SUMO Payment Plans
    • WooCommerce German Market
    • WC Vendors Marketplace
    • WooCommerce Print Invoices & Packing Lists
    • WooCommerce Deposits
    • WooCommerce Cart Abandonment Recovery by CartFlows
    • WooCommerce Waitlist
    • WooCommerce Simple Auctions
    • YITH Auctions for WooCommerce
    • YITH WooCommerce Stripe
    • YITH Membership
    • YITH Subscription
    • YITH Booking and Appointment
    • YITH WooCommerce Recover Abandoned Cart
    • YITH Wishlist
    • YITH Pre-Order
    • YITH Gift Cards
    • YITH Review For Discounts
    • YITH Multi Vendor
    • YITH WooCommerce Points and Rewards
    • YITH WooCommerce Request a Quote
    • YITH WooCommerce Affiliates
    • YITH WooCommerce Coupon Email System
    • YITH Advanced Refund System for WooCommerce
    • YITH Easy Login & Register Popup
    • YITH WooCommerce Delivery Date
    • WooCommerce Order Delivery Date Pro
    • Colissimo Shipping Methods for WooCommerce
    • WooCommerce Deposits & Partial Payments
    • Custom User Registration Fields by Addify
    • Quotes for WooCommerce
    • RMA Return Refund and Exchange For WooCommerce
    • License Manager for WooCommerce
    • WooCommerce Product Vendors
    • MultiVendorX
    • WooCommerce Stripe Payment Gateway
    • WooCommerce B2B
    • Order Cancellation Email To Customer
    • WooCommerce Order Delivery
    • Account Funds
    • TeraWallet for WooCommerce
    • Points And Rewards for WooCommerce
    • WooCommerce Split Orders
    • WP Crowdfunding
    • WooCommerce PDF Product Vouchers
    • MultiLocation Inventory & Order Routing
    • Woo Sell Services
    • WooCommerce Return & Warranty Management
    • WholesaleX
    • ShopMagic
    • WooCommerce Contact for Shipping Quote
    • MarketKing
    • AliDropship for WooCommerce
    • Custom Fields by Addify
  • Why Upgrade?
  • OTHER LINKS
    • FAQs
    • Troubleshooting
      • Continuous loading
      • Unable to save template
      • Unable to save Emoji
      • Unable to send test email
      • How to clear cache
      • How to use YayMail with GoDaddy
    • Changelog
      • YayMail Conditional Logic
    • Useful Links
      • AppSumo Deal
    • Support
      • How to pay without PayPal
      • How to renew the license key
      • How to change payment method
  • Articles
    • Design Tips
      • Customize Order Confirmation Email
      • Preview and Test Your Emails
      • Design a Black Friday Banner
      • Embed a Video in WooCommerce Email
      • Add Conditional Logic to WooCommerce Emails
    • Email Marketing
      • Setup Next Order Coupon in WooCommerce Emails
      • Automatically Send “Customer Invoice/Order Details" to Customers
      • Create Emails with Dynamic Content
      • Customize WooCommerce Membership Emails
      • Recover Abandoned Cart
    • Advanced Guides
      • Create WooCommerce Custom Emails Per Product
      • Customize ShopMagic Automation Emails
      • Create Custom Shortcode for YayMail
      • Translate Emails with Loco Translate
Powered by GitBook
On this page

Was this helpful?

  1. Drag-and-Drop Email Builder
  2. Upper Toolbar

Custom shortcode

PreviousShortcodesNextReset Templates

Last updated 1 month ago

Was this helpful?

You can also create your own shortcodes using filter by adding shortcode name with prefix: yaymail_custom_shortcode_['name'] in file functions.php of your site's theme.

Note: Custom shortcode must use the prefix: yaymail_custom_shortcode_['name']. Custom shortcodes only work in emails when you place an actual order, they do not work when you send test emails.

Example 1:

You can copy the code from here:

add_filter(
    'yaymail_customs_shortcode',
    function( $shortcode_list, $yaymail_informations, $args = array() ) {
        $shortcode_list['[yaymail_custom_shortcode_new_order]']        = 'Custom shortcode test New order';
        $shortcode_list['[yaymail_custom_shortcode_processing_order]'] = 'Custom shortcode test Processing order';
        $shortcode_list['[yaymail_custom_shortcode_order_on_hold]']    = 'Custom shortcode test Order on hold';
        return $shortcode_list;
    },
    10,
    3
);

Example 2:

You can copy the code from here:

function test_shortcode1(  $shortcode_list, $yaymail_informations, $args = array() ) {
	//It only runs when tested with real order
	if (isset ($args['order'])) {
		$order = $args['order'];
		$order_id = $order->get_id();
		return $order_id;
	}
	
	// in Yaymail will show it
	return 'test_shortcode';
}

add_filter(
	'yaymail_customs_shortcode',
	function( $shortcode_list, $yaymail_informations, $args = array() ) {
			$shortcode_list['[yaymail_custom_shortcode_test]']            = test_shortcode1($shortcode_list, $yaymail_informations, $args);
		return $shortcode_list;
	},
	10,
	3
);

You can see your custom shortcodes in the list here.

YayMail Custom shortcodes