Skip to content
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

New 'listtype' variable for $woocommerce_loop and consistent filters for upsell and cross-sell queries #10028

Closed
wants to merge 10 commits into from

Conversation

duracelltomi
Copy link
Contributor

I am the developer of the plugin "DuracellTomi's Google Tag Manager for WordPress". While extending the implementation of the Google Analytics Enhanced Ecommerce tracking in my plugin, I found some opportunity to make the code better.

Inconsistent WP filters

There are some inconsistencies in the code:

  • related products template uses a WP filter for the whole WP query args
  • up-sells template does not have any WP filter for WP query args
  • cross-sells template only apply a WP filter for the posts_per_page arg

I modified the codes to use a WP filter for each template for the whole WP query args array.

New variable for the loop

I added a new variable to the $woocommerce_loop array so that during product code generation I and other plugin authors can "see" in the code which type of product list is being generated: general product category, related products, upsells, etc.
I think this will be useful for other plugin authors and theme developers as well.

Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
There is already a filter in related.php, let plugin authors and theme developers hook into this as well.
There is already a filter in related.php, let plugin authors and theme developers hook into this as well.
woocommerce_cross_sells_total should be marked as deprecated
Using this plugin authors and theme developers can see what kind of product list is being generated in the loop.
@mikejolley
Copy link
Member

Will review for 2.6.

@mikejolley mikejolley added this to the 2.6 milestone Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants