Skip to content

[3.6] Fix product class name theme conflict due to missing global#23377

Merged
mikejolley merged 6 commits intomasterfrom
fix/23374
Apr 24, 2019
Merged

[3.6] Fix product class name theme conflict due to missing global#23377
mikejolley merged 6 commits intomasterfrom
fix/23374

Conversation

@mikejolley
Copy link
Copy Markdown
Member

Fixes #23374

In 3.5.x wc_get_product_class used get_post when grabbing the post/product objects. get_post pulls the global $post if null (https://developer.wordpress.org/reference/functions/get_post/).

In 3.6.x this was switched to just wc_get_product which does not use the global.

This lead to themes which uses wc_product_class without passing a product object to have missing CSS class names. Core is unaffected because it passes the $product object to this function.

To test, try the theme zip in #23374. On the shop page, results should be styled correctly and have classes such as 'product type-product' in the markup.

  • Fix - [3.6.x] Fix CSS classname conflict with themes due to missing product object global.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2019

Codecov Report

Merging #23377 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted Files Coverage Δ Complexity Δ
includes/wc-template-functions.php 6.89% <0%> (-0.02%) 0 <0> (ø)
includes/api/class-wc-rest-authentication.php 3.74% <0%> (-0.04%) 87% <0%> (ø)
includes/class-wc-tax.php 80.94% <0%> (+0.26%) 131% <0%> (ø) ⬇️

@timmyc timmyc requested review from claudiosanches and kloon April 19, 2019 01:02
Copy link
Copy Markdown
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!
This is keep backwards compatibility now.

Co-Authored-By: Dragoș Mocrii <dragosmocrii@users.noreply.github.com>
@mikejolley mikejolley merged commit c427505 into master Apr 24, 2019
@mikejolley mikejolley deleted the fix/23374 branch April 24, 2019 13:54
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.

WooCommerce Shop/Category Page Layout breaks after update

3 participants