Support » Plugin: Kadence WooCommerce Email Designer » Adding my own placeholders

Viewing 3 replies - 1 through 3 (of 3 total)
  • hannah

    (@hannahritner)

    Hey,
    Thanks for reaching out! To add custom fields you would need to add them into the email through woocommerce hooks. You can read about it here: https://rudrastyh.com/woocommerce/order-meta-in-emails.html
    Hope that’s helpful!

    Best,
    Hannah

    Hi, I would like to add a custom placeholder to display value from custom billing field through WooCommerce Checkout Manager plugin (i.e : billing_wooccm12 ), and below is the function from them to access the data.

    function get_wooccm_fields($fields, $order) {
    
    if (count($billing = WOOCCM()->billing->get_fields())) {
    foreach ($billing as $field_id => $field) {
    if (!in_array($field['name'], WOOCCM()->billing->get_defaults())) {
    if ($value = get_post_meta($order->get_id(), sprintf('_%s', $field['key']), true)) {
    $fields[$field['key']] = array(
    'label' => $field['label'],
    'value' => $value
    );
    }
    }
    }
    }
    
    if (count($shipping = WOOCCM()->shipping->get_fields())) {
    foreach ($shipping as $field_id => $field) {
    if (!in_array($field['name'], WOOCCM()->shipping->get_defaults())) {
    if ($value = get_post_meta($order->get_id(), sprintf('_%s', $field['key']), true)) {
    $fields[$field['key']] = array(
    'label' => $field['label'],
    'value' => $value
    );
    }
    }
    }
    }
    
    if (count($additional = WOOCCM()->additional->get_fields())) {
    foreach ($additional as $field_id => $field) {
    if (!in_array($field['name'], WOOCCM()->additional->get_defaults())) {
    if ($value = get_post_meta($order->get_id(), sprintf('_%s', $field['key']), true)) {
    $fields[$field['key']] = array(
    'label' => $field['label'],
    'value' => $value
    );
    }
    }
    }
    }
    
    return $fields;
    }

    May I know how to add one of those values to the available placeholder?

    Hi @bioe1357,
    That is not something our support can help you with. The code you posted would require a dev to make work as a placeholder in emails.

    You can look at this example here for a basic way to add placeholders:

    https://wordpress.org/support/topic/available-placeholders-are-very-limited/#post-12050919

    Ben

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.