• Resolved zhuzh1

    (@zhuzh1)


    I modified a few places in WooCommerce and Product Vendors email templates. They seem to be working.

    Now, I am wondering if there is something like “child-plugin” to plugins as child-theme to themes. I am trying to avoid the troubles during plugin upgrades when I have to manually move my changes from current files to (new) upgraded plugins.

    In general, my question is: what is the best practice for managing customizations to WooCommerce and its extensions (e.g. Product Vendors)?

    Regards,

    JohnZ

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi John,

    The best solution would be to create a custom child-theme or apply the code overrides to a snippet plugin like Code Snippets:

    https://www.ads-software.com/plugins/code-snippets/

    Hope this helps!

    Thread Starter zhuzh1

    (@zhuzh1)

    John,

    Thanks for your advice. BTW, may you please elaborate on “custom child-theme”?

    I did create a child theme (storefront-child for storefront) which houses modifications of php files under storefront theme. Now, I like to do similar things to plugins (e.g. WooCommerce and its extensions). Can I?

    I’ll give Code Snippet approach a try

    Thanks again

    John

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @zhuzh1

    >may you please elaborate on “custom child-theme”?

    Maybe the term “custom” was redundant but as long as you are using a child-theme you should have the best success with overrides as updates will not be applied to the files contained within that theme.

    Thread Starter zhuzh1

    (@zhuzh1)

    Hi @johndcoy,

    How to deal with modified files in plugins?

    I looked at Code Snippets plugin. It is a great tool for code snippets such as add_action(…). However, I have felt that it might not be much help if changes are to html files such as adding one row to an existing table. Am I right?

    Thanks

    Jz

    Thread Starter zhuzh1

    (@zhuzh1)

    Hi @johndcoy,

    In the above, I was specifically referring modifications in email_order_details.php both under woocommerce and under woocommerce-product-vendors plugins: I felt that Code Snippets is probably not applicable, isn’t it?

    Thanks

    JohnZ

    @zhuzh1
    Hello
    Changing email_order_details.php in child theme SHOULD override the plugin modifications. Just create the file: wp-content/themes/storefront-child/woocommerce/emails/admin-new-order.php

    Hope it helps!

    Thread Starter zhuzh1

    (@zhuzh1)

    @wpriders

    Just to confirm, do you mean to copy

    ~/wp-content/plugins/woocommerce/templates/emails/email-order-details.php or
    ~/wp-content/plugins/woocommerce-product-vendors/templates/emails/email-order-details.php
    to
    ~/wp-content/storefront-child/woocommerce/templates/emails/email-order-details.php or
    ~/wp-content/storefront-child/woocommerce-product-vendors/templates/emails/email-order-details.php

    then modify it?

    thanks

    Thread Starter zhuzh1

    (@zhuzh1)

    @wpriders

    Just an update:

    I moved email-order-details.php for Product Vendors plugin to a child theme’s directory
    ~/wp-content/storefront-child/woocommerce-product-vendors/templates/emails/ then made changes. In my test, woocommerce still picked up the one (email-order-details.php) in the original plugin directory, not the one in my child theme.

    My thinking: without child theme, plugin files are all outside of the theme (I am storefront now). To move them inside my child theme, Should I follow some convention to structure directories for them to be picked up?

    Thanks

    John

    Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there John,

    You were very close with your solution!! When copying the template file to your child theme, you would follow the same directory structure, but you would remove “templates”. So you would end up with:

    storefront-child/woocommerce-product-vendors/emails/email-order-details.php

    This is discussed in the documentation here (although for a different template file):
    https://docs.woocommerce.com/document/productvendors-faq/#section-9

    Hope this helps!!

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @zhuzh1

    We haven’t heard back from you in a while, so I hope you’ve got this one sorted now.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks,

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Best ways to customize Woo’ is closed to new replies.