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

Added option to get variations with stock 0 in feed + new query #57

Merged
merged 22 commits into from
May 22, 2024

Conversation

jeremykervran
Copy link
Contributor

Je pense qu'on a pas d'autre choix que de faire une query custom pour gérer les variations à stock 0 dans le flux, à cause du fonctionnement de base de WC qui base tout sur une option : https://woocommerce.github.io/code-reference/files/woocommerce-includes-class-wc-product-variable.html#source-view.302

Modifier cette option à la volée entrainerait trop d'effets de bords possibles.

Y'a potentiellement mieux que la WP_Query que je fais dans get_all_product_variations( $product ) - src/Products/Product.php ligne 454, en passant par une WC_Query peut-être ?

Mais en l'état ça marche :

21 0 // STOCK A ZERO QUI REMONTE 10.00 8.00 variation-1

@petitphp
Copy link
Member

petitphp commented Sep 23, 2022

@jeremykervran Je vois que WC_Product_Variable::get_available_variations appel en interne WC_Product_Variable::get_children et filtre les éléments ensuite.

De notre côté, si la personne à choisis d'avoir toutes les variations même avec un stock à zéro on pourrait utiliser WC_Product_Variable::get_children pour récupérer les variations et faire les traitements ?

@jeremykervran jeremykervran self-assigned this Sep 30, 2022
src/Admin/Options.php Outdated Show resolved Hide resolved
src/Admin/Options.php Outdated Show resolved Hide resolved
src/Products/Product.php Outdated Show resolved Hide resolved
src/ShoppingFeedHelper.php Outdated Show resolved Hide resolved
src/Feed/Generator.php Outdated Show resolved Hide resolved
Copy link
Member

@petitphp petitphp left a comment

Choose a reason for hiding this comment

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

@jeremykervran Il faudrait qu'on se repose sur la PR pour voir. Je me demande si ça n'ajoute pas un effet de bord l'ajout du paramètre $for_feed.

src/Products/Product.php Outdated Show resolved Hide resolved
src/Products/Product.php Outdated Show resolved Hide resolved
src/Products/Product.php Show resolved Hide resolved
src/Admin/Options.php Outdated Show resolved Hide resolved
src/ShoppingFeedHelper.php Outdated Show resolved Hide resolved
src/Admin/Options.php Outdated Show resolved Hide resolved
src/Products/Product.php Outdated Show resolved Hide resolved
src/Products/Product.php Outdated Show resolved Hide resolved
@petitphp petitphp changed the base branch from main to develop July 11, 2023 09:25
@petitphp
Copy link
Member

TODO: rebase develop

@petitphp petitphp force-pushed the issue/58586 branch 3 times, most recently from b8d017c to 5dfd36e Compare September 19, 2023 14:36
@petitphp petitphp force-pushed the issue/58586 branch 2 times, most recently from 19dc228 to 56626f9 Compare February 22, 2024 23:02
@petitphp petitphp force-pushed the issue/58586 branch 2 times, most recently from 413fc14 to bc6d93d Compare May 15, 2024 20:50
@petitphp petitphp removed the request for review from Rahe May 15, 2024 20:51
@petitphp petitphp merged commit 02049ec into develop May 22, 2024
2 checks passed
@petitphp petitphp deleted the issue/58586 branch May 22, 2024 09:47
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

3 participants