Commit Graph

138 Commits

Author SHA1 Message Date
Rodrigo Primo 36cdc3cf8f Simplify and modernize WC_Emails::queue_transactional_email()
This commit replaces calls to call_user_func_array() with the spread operation.
2019-11-22 15:25:44 -03:00
Peter Fabian a2cd974d79 Don't display Downloads section on refund emails. 2019-11-01 15:51:30 +01:00
Gerhard d4eb233843 Deprecate email_footer_replace_site_title and use replace_placeholders 2019-07-04 09:36:05 +02:00
Claudio Sanches 22f9cdcb0d Allow {woocommerce} placeholder in lowercase 2019-05-21 17:47:54 -03:00
Mike Jolley 003a5bd188 Better placeholder replacement for footer 2019-03-04 14:53:19 +00:00
JeroenSormani f4775ccd90 Use shipping method instead of property through magic + doc return statements 2019-01-04 12:41:38 +00:00
claudiulodro 33154afd03 Send emails for cancelled_to_* orders 2018-08-31 09:31:16 -07:00
Mike Jolley c3144012a5 Include as needed 2018-06-15 12:43:10 +01:00
Mike Jolley d9d2093d50 Log errors from transaction emails with logger
Closes #20118
2018-05-24 15:37:00 +01:00
Claudio Sanches a529e1fdf3 Fixed includes/class-wc-emails.php PHPCS violations 2018-03-22 14:54:16 -03:00
Caleb Burks c21cc2e8fe Replace “Cheatin’ uh?” with friendlier messages 2018-02-07 17:01:12 -05:00
The Dramatist 85ce4e0078 Class wc emails backorder method extract function removed (#17724)
* Replaced extract() function usage.

Usage of `extract()` is kinda discouraged. Though here the array `$args` is verified, I think avoiding this `extract()` function will make it better. Besides, without `extract()` the code is more readable and easily understandable.

* Object checking should be done.

Checking `$args['product']` is an object or not should be done before `get_formatted_name()` method is being called.
2017-11-17 11:38:26 +00:00
Claudiu Lodromanean f7d52ad0ba
Merge pull request #17542 from MikeKoval/master
Update class-wc-emails.php
2017-11-07 09:37:31 -08:00
Mike Jolley c824dd7a85 Hide downloads from admin emails 2017-11-06 17:02:35 +00:00
Mike Koval d15aaf682d
Update class-wc-emails.php
Added missing param sent_to_admin to email-addresses template
2017-11-03 11:33:55 +02:00
Mike Jolley 9d92b8a8ff phpcs 2017-11-01 13:10:25 +00:00
Ryan Halliday 671b602db6 Added `{site_title}` replacement to Email footer 2017-10-28 15:18:53 +13:00
Claudio Sanches 2dd5288659 Fixed WC_Emails::wrap_message hooks
Included `null` instead of instances of `WC_Email`, fixing fatal error
for extensions that expects all params from both hooks.

Closes #16936
2017-09-26 13:27:50 -03:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Mike Jolley b6847ebe60 remove exit 2017-07-11 16:09:31 +01:00
Mike Jolley 94b32e644a HTML emails 2017-07-11 14:52:30 +01:00
amansaini 03699dcaae Fixes issue #15489 2017-06-07 11:58:09 +05:30
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Mike Jolley 6259ee69e9 Adds a fallback to queue_transactional_email if background sending is disabled.
Fixes #14476

After turning off deferred emails by default it seems Subscriptions was
using the ‘default’ value in a filter to check if deferred emails were
enabled or not to hook in these methods.

https://github.com/woocommerce/woocommerce-subscriptions/blob/f87a11cdf0
9bb59aa66f4e86d37592f74193937f/includes/class-wc-subscriptions-email.php
#L339

@thenbrent

This code change adds a fallback so if this method was hooked in
anywhere, and the background emailer was not init or disabled, it will
fallback to regular send-now.
2017-04-18 11:35:37 +01:00
Mike Jolley 77d93a70e0 Set woocommerce_defer_transactional_emails to false by default 2017-04-13 14:22:33 +01:00
Mike Jolley 180f5cd40b send_transactional_email try catch block 2017-04-13 14:22:07 +01:00
Mike Jolley 85a67151ff woocommerce_notify_low_stock and woocommerce_notify_no_stock were not hooked up 2017-04-12 18:01:59 +01:00
Claudio Sanches fa40e7b205 Merge pull request #14035 from woocommerce/fix/13963
Background Emailer instead of just CRON
2017-04-06 14:47:15 -03:00
Mike Jolley 288026ca9f Background Emailer instead of just CRON 2017-04-06 13:46:07 +01:00
Claudio Sanches e2881d5af1 Ensure gateways are loaded in emails
Fix missing bank details in emails

closes #13966
2017-04-05 15:50:40 -03:00
Mike Jolley 9d5aee2c73 Remove code which expands/changes objects in emails 2017-03-21 17:36:46 +00:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Mike Jolley 737c962e48 docblock 2017-02-28 21:16:58 +00:00
Mike Jolley 4f333d0e82 More efficient expand 2017-02-28 21:16:03 +00:00
Mike Jolley fb576b015b Email cron jobs - avoid storing full data objects 2017-02-28 20:35:52 +00:00
Mike Jolley f2990b0c7d Check we have a WC_Order during email events 2017-02-27 17:08:13 +00:00
Claudio Sanches 4eccbef6e1 Fixed infinite loop cause by duplicated hook names 2017-02-24 17:02:05 -03:00
Mike Jolley 8ae66520e8 woocommerce_send_queued_transactional_email filter
Closes #13318
2017-02-24 13:16:41 +00:00
Claudiu Lodromanean ab8fb48bb4 Fix and standardize e-mail sending 2017-02-09 14:49:39 -08:00
Claudio Sanches c350ecfb99 Fixed PHP 5.2 fatal error, closes #13128 2017-02-09 15:27:26 -02:00
Mike Jolley 16afdeec96 Add prefix 2017-02-09 12:30:33 +00:00
Mike Jolley e46b256c67 Use cron to send emails to avoid long page load times on checkout 2017-02-01 20:08:18 +01:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Mike Jolley 76b32c9aa5 WIP - Product CRUD (#12065)
* Created function to get the catalog visibility options

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Sanitize ids later

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Bump template version

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* Made abstract function useful

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* Allow WP_Query to preload post data, and meta in wc_get_products()

Allow WP_Query to bulk query for post data and meta if more than
just IDs are requested from wc_get_products(). Reduces query count
significantly.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* First methods for WP_Product crud

* Product set methods

* Fixed several erros while setting data

* Hardcode the get_type per product class

* Initial look through getters and setters and abstract data

* Missing var

* Fixed coding standards and improved the docblocks

* Get cached terms from wc_get_related_terms()

* Fixed wrong variable in wc_get_related_terms

* Use count() instead of sizeof()

* Add related product functions and deprecate those in class.

* No need to exclude ID

* Sanitize ids later

* Clean up the abstract product class a bit, deprecate two functions we have renamed, make update & create work properly, and add some tests for it.

* Remove unneeded comments

* wc_get_product_term_ids instead of related wording and use in other places.

get_the_terms is used here and also handles caching, something
wp_get_post_terms does not.

* Handle PR feedback: Remove duplicate regular_price update, allow changing of post status for products, remove deprecation for get_title since we might still offer it as a function

* External Product CRUD

* _virtual meta should be 'no', not taxable, in product unit test helper

* Bump template version

* Made abstract function useful

* Grouped product class

* Tests

* Move children to meta and update test

* Use get_upsell_ids

* Spacing in query

* Moving and refactoring methods

* Availability html

* Tidy/add todos

* Rename method

* Put back review functions (still todo)

* missing $this

* get_price_including_tax/excluding_tax functions

* wc_get_price_to_display

* Price handling

* [Product CRUD] Variable (#12146)

* [Product CRUD] Variable Products

* Handle PR feedback.

* [Product CRUD] Grouped Handling (#12151)

* Handle grouped product saving

* Update routine

* [Product CRUD] Product crud terms (#12149)

* Category and tag id handling

* Replace template functions

* Remove todo

* Handle default name in save function

* Product crud admin save routine (#12174)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Spacing

* Fix comment

* wc_implode_text_attributes helper function

* [Product CRUD] Product crud admin use getters (#12196)

* Initial props

* Work on admin saving

* Set/get attributes

* Atom was moaning about this before but no longer.

* Update get_shipping_class

* WC_Product_Attribute

* Use getter in admin panel

* Fix attribute saving

* Move settings into new files

* Refactor panels and use getters

* Use getters for variation panel

* Revert save variation changes for now

* Add todos

* Fix downloads

* REST API CRUD Updates

* Additional API updates/fixes. Added some todos

* Fix final failing tests and implementing setters/getters and attributes functionality.

* Fix comparison for is_on_sale and remove download_type from WC_Product.

* Add a wc_get_products wrapper.

* Remove the download type input from the product data metabox for downloadable products. (#12221)

* [Product CRUD] Variations - setters, getters and admin. (#12228)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* Feedback fixes

* Implement CRUD in the legacy REST API

* Handle PR feedback

* [Product CRUD] Getter setter proxy methods (#12236)

* Started on variation changes

* Stock functions

* Variation class

* Bulk change ->id to get_id() to fix variation form display

* Missing status

* Fix add to cart

* Start on stored data save

* save variation

* Save_variations

* Variation edit panel

* Save variations code works.

* Remove stored data code and fix save

* Improve legacy class

* wc_bool_to_string

* prepare_set_attributes

* Use wc_get_products

* More feedback fixes

* get_prop implementation in abstract and data classes

* Implement set_prop

* Change handling

* Array key exists

* set_object_read

* Use get_the_terms() instead of wp_get_post_terms()

wp_get_post_terms() is a wrapper around wp_get_object_terms() which does not
use the object cache, and generates a database query every time it is used.

get_the_terms() however can use data from the object cache if present.

* [Product CRUD] Variable, variation, notices, and stock handling (#12277)

* No longer needed

* Remove old todos

* Use getters in admin list

* Related and upsells update for CRUD

* Fix notice in gallery

* Variable fixes and todos

* Context

* Price sync

* Revert variation attributes change

* Return parent data in view context

* Defer term counting

* wc_find_matching_product_variation

* Stock manage tweaks

* Stock fixes

* Correct id

* correct id

* Better sync

* Data logic setter fix

* feedback

* Prevent notices

* Handle image_id from parent

* Fix error

* Remove _wc_save_product_price

* Remove todo

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* [Product CRUD] Abstract todos (#12305)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Revert "[Product CRUD] Abstract todos (#12305)"

This reverts commit 9a6136fcf8.

* Remove deprecated get_variation_id()

* New default attributes method

* [Product CRUD] Product Datastore (#12317)

* Fix up tests in the product/* folder.

* Handle data store updates for grouped, variable, external, simple, and general data store updates for products.

* Variations & variable changes.

* Update -functions.php calls to use data store.

* Add an interface for the public product data store methods.

* Finished product factory tests

* Correctly delete in the api, fix up some comments, and implement an interface for the public variable methods.

* Fix up delete in all versions of the api

* Handle feedback

* Match protected decloration to parent

* Product crud abstract todos (#12316)

* Get dimensions and weights, with soft deprecation

* Product attributes

* Ratings

* Fix read method

* Downloads

* Feedback

* Fix up store

* Fixed method returning in write context

* Fix error in variation admin

* Check for parent value - fixes tax class

* Remove old/complete todos

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed wrong variation URLs

* Fixed undefined $image_id in WC_Product_Variation::get_image_id()

* Allow wc_rest_prepare_date_response() handle timestamps

* Updated get methods on REST API for variations

* Use variations CRUD to save variations metadata

* Remove deprecated get_variation_id()

* New default attributes method

* Fixed method returning in write context

* Allow set tax class as "parent"

* Removed duplicated sync

* Fixed coding standards

* TODO is not accurate.

* Should pass WC_Product instancies to WC_Comments methods (#12327)

* Use new method in abstract order class to prevent headers sent issue in tests

* Fixed variable description in REST API

* Updated how create initial product variation

* Fixed a few fatal errors and warnings in Products CRUD (#12329)

* Fixed a few fatal errors and warnings in Products CRUD

* Fixed sync functions

* Add variations CRUD to legacy API (#12331)

* Apply crud to variable products in legacy API v1

* New REST API do not need fallback for default attributes

* Apply variations CRUD to legacy API v2

* Legacy v2 - save default attributes

* Variations in legacy API v2 do not have descriptions

* Fixed legacy API v2 variations params

* Applied variations CRUD to legacy API v3

* Sync before save in legacy apis

* Punc

* Removed API todos

* Removed test

* Products endpoint tweaks (#12354)

* Var type already normalized on CRUD

* Let Product CRUD handle with validation, sanitization and conditional checks

* Set downloads using WC_Product_Download

* Stop try catch exceptions more than one time

* Handle WC_Data_Exception in legacy API

* Complete remove products when fails on creating

* On creating I mean!

* Already have a method to complete delete products

* Fixed standards using WP CodeSniffer

* get_the_terms() returns false when empty

* get_manage_stock returns boolean

@claudiosanches

* Merge conflict

* Variations API endpoint fixes

* Product CRUD improvements (#12359)

* args is not used any more - remove todo

* Added test for attributes

* wc_get_price_excluding_tax usage

* parent usage

* Fix rating counts

* Test fixes

* Cleanup after tests

* Make sure status transition code runs even during API calls, not just in admin.

* Default visibility

* Fix attribute setting in API

* Use get name instead of get title

* variation id usage

* Improved cross sell templates

* variation_data

* Grouped product sync

* Notices

* Sync is not needed in API

* Delete

* Rename interfaces

* Update counts in data store
2016-11-16 12:38:24 +00:00
Rami Yushuvaev e705102b6b Fix travis error 2016-10-29 16:13:46 +03:00
Rami Yushuvaev 4e36ce7425 add translators comments 2016-10-29 15:57:09 +03:00
Claudio Sanches 8484c8657e Display structured data in WC_Emails::order_schema_markup() 2016-10-13 19:39:27 -03:00
Claudio Sanches b9dfdacad4 Removed confuse helper 2016-10-13 18:19:13 -03:00
Claudio Sanches 68b864313a Fixed conflicts 2016-10-13 16:58:20 -03:00
Claudio Sanches 657c312cae Fix strings case (#12069)
* Fixed case for all _e, esc_attr_e and esc_html_e strings

* Fixed case for all _n_noop strings

* Fixed case for all _x strings

* Fixed case for all __, esc_html__ and esc_attr__ strings

* Fixed a few more strings

* Fixed strings in unit tests

* Fix PayPal Standard case.

* Save Order text
2016-10-12 11:16:30 +01:00