Support » Fixing WordPress » Customize Woocommerce order email by product add-on

  • Hi,
    We are developing our new website with Woocommerce plug in.
    We would like to customize our order confirmation email according to:

    1.-The type of product chosen.
    2.- The ad-on drop down combo box customer selection.

    I imagine there are several vars that handle whych is the product or products in the cart as well as the ad-dons. But where can we find information to create that code properly?

    Thanks in advance,
    Dani

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    In the WC settings there’s an email tab that lists all the different emails that WC sends out. Click the settings gear icon of the email you wish to change. Click the View Template button at the bottom. You’ll likely see the template is largely composed of a series of actions. The callbacks that WC adds to each should be documented in the inline comments. Each callback typically has a filter where you can alter the generated markup.

    Thus you have several opportunities to alter emails. The markup filter and using a customized template are generally not the best choice. The template actions are your best option. You can remove the WC callbacks and replace them with your own. You could copy portions of the WC callback source code into your version if that’s helpful at all. The WC source code can be quite confusing, you are probably better off generating your own content.

    Each email template action typically passes the relevant order object. It should contain all the information you need to generate an appropriate email message. To examine the object’s properties in order to learn how to access the various elements, add an action callback that var_dumps the order object. Make a sample order and have WC email the var_dumped message to yourself.

    It may not be possible to directly access some order properties, you may need to utilize order object methods. Refer to the class declaration to see the available methods. woocommerce/includes/abstracts/abstract-wc-order.php

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