Cart Block: Cart Line Items: Description #10757
-
Hello dear WooCommerce team, we hope you are well up and can help us. When using the cart block, the short description of a simple product is outputed. For variations of variable products, the description of the variation is output. So far, we have provided the short description output in the cart shortcode in our own plugin. Some shop admins have requested not to display the description. If it should be displayed, it can be set for variations whether the short description of the variable product, the description of the variation or both should be displayed. According to the documentation https://github.com/woocommerce/woocommerce-blocks/blob/trunk/docs/third-party-developers/extensibility/checkout-block/available-filters.md#cart-line-items, unfortunately, the description cannot be filtered. So that here the wishes of the shop admins can not be addressed. Is there another possibility to influence the output or could a filter (registerCheckoutFilters) be added for the description? Thanks in advance for any advice and help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Since the
I can achieve a simple solution using PHP filters. For variations for example, you can use |
Beta Was this translation helpful? Give feedback.
Since the
ProductSummary
component uses the short description if it is not empty and the "full description" otherwiseconst source = shortDescription ? shortDescription : fullDescription;
I can achieve a simple solution using PHP filters. For variations for example, you can use
woocommerce_product_variation_get_short_description
. In the callback, conditional tags are used to check whether you are in the cart or checkout block. So for instance, I can output the short description of the parent product followed by the description of the variation.