Closed rawdreeg closed 3 months ago
Thanks @nima-karimi for the review.
Not to be a party pooper here, but given that this is in a WooCommerce context and that WooCommerce also has filters for $product->get_name();
one would think that using that everywhere would be more future proof as WooCommerce might move products to custom tables just as they did with orders (HPOS).
Using native getters and setters on objects is the preferable way to code for WooCommerce anyway, so people using the post title filter might be considered to be "doing_it_wrong".
Thanks @Dekadinious,
I picked get_title() over get_name(). This is used for the catalogue product as well: https://github.com/woocommerce/facebook-for-woocommerce/blob/df03a97e449b242c1ef59ddc70eac2de966cc3e8/includes/fbproduct.php#L657
This aligns the events sent with whatever name is set to Catalogue, reducing the risk of mismatch.
Sorry, had a brain fart there for a second. Move on, nothing to see here! :)
Changes proposed in this Pull Request:
We received a report ( #2774 ) pointing out inconsistencies in populating the content_name property in events we send to Meta, sometimes using
get_title()
vsget_name()
. I have looked into this and found thatget_title()
applies thewoocommerce_product_title
filter to the product name prop. This may result in different values being sent to Facebook. I also find that we use get_title for the catalog data, so I propose we use the get_title methodCloses #2774.
phpcs
checks? Please removephpcs:ignore
comments in changed files and fix any issues, or delete if not practical.Detailed test instructions:
woocommerce_product_title
filter. E.g.:Additional details:
Changelog entry