-
Notifications
You must be signed in to change notification settings - Fork 54
implement cogs feature #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this! A few observations:
-
If the store has COGS disabled, a notice is shown for each product that's created:
Notice: Function WC_Product::set_cogs_value was called <strong>incorrectly</strong>. The Cost of Goods sold feature is disabled, thus the method called will do nothing and will return dummy data. Backtrace: … wc_doing_it_wrong Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 9.5.0.) in /var/www/html/wp-includes/functions.php on line 6121
Maybe conditionally setting the value using
( wc_get_container()->get( 'Automattic\WooCommerce\Internal\CostOfGoodsSold\CostOfGoodsSoldController' )->feature_is_enabled() )
would make sense? -
The variable products also have a default COGS value (even if all the variants also have one set). Would it make sense to set it to some % of the lowest variant's price?
-
Finally, would it make sense to have some products generate with no COGS (not set, or 0)?
Co-authored-by: Justin P <[email protected]>
Co-authored-by: Justin P <[email protected]>
Thanks @layoutd! If the store has COGS disabled, a notice is shown for each product that's created: Maybe conditionally setting the value using ( wc_get_container()->get( 'Automattic\WooCommerce\Internal\CostOfGoodsSold\CostOfGoodsSoldController' )->feature_is_enabled() ) would make sense? As COGS will be in released to core in V10.3 (without the need to activate it i assume) the first point should be covered. The Core Release is in two weeks, i guess we'll probably aim for a later SmoothGenerator release anyway. The variable products also have a default COGS value (even if all the variants also have one set). Would it make sense to set it to some % of the lowest variant's price? Finally, would it make sense to have some products generate with no COGS (not set, or 0)? |
All Submissions:
Changes proposed in this Pull Request:
WooCommerce Core is getting the Cost of Goods Sold (COGS) feature soon. (currently behind a feature flag)
We should allow to also auto generate COGS Values inside Smooth Generator.
Approach automatically generates it for simple and variable products while deducting a random 15-60% from the regular price
Closes #175 .
How to test the changes in this Pull Request:
Other information:
Changelog entry
implement cost of good sold (cogs) generation
FOR PR REVIEWER ONLY: