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

[product_page id="_"] shortcode is not recognizing breaks in product description #26191

Closed
3 tasks done
jrick1229 opened this issue Apr 15, 2020 · 4 comments
Closed
3 tasks done
Labels
focus: product Issues related to product or product page. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Kirigami & Origami WC Store Editing (FSE) type: bug The issue is a confirmed bug.

Comments

@jrick1229
Copy link

Describe the bug

When using the [product_page id="_"] shortcode with a product that has a description, the description is not recognizing line breaks between multiple </p> elements. Additionally, it's also removing the <p> elements and just placing the description text directly inside of the <div>.

To Reproduce

Steps to reproduce the behavior:

  1. Create a product with a description that breaks onto multiple lines: https://d.pr/i/Iv1g0Z
  2. Create a page using a shortcode block with [product_page id="_"]: https://d.pr/i/iewqeP
  3. Look at regular product page and see correct description compiling: https://d.pr/i/KcCqXJ
  4. Look at shortcode page and see incorrect description styling: https://d.pr/i/9W8NHj

Screenshots

Product description settings: https://d.pr/i/Iv1g0Z
Shortcode page settings: https://d.pr/i/iewqeP
Normal product page: https://d.pr/i/KcCqXJ
Shortcode product page: https://d.pr/i/9W8NHj

Expected behavior

The description should carry over both line breaks and any elements being used in the original description.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

### WordPress Environment ###

WordPress address (URL): https://joeyricketts.mystagingwebsite.com
Site address (URL): https://joeyricketts.mystagingwebsite.com
WC Version: 4.1.0
REST API Version: ✔ 1.0.7
WC Blocks Version: ✔ 2.5.16
Action Scheduler Version: ✔ 3.1.4
WC Admin Version: ✔ 1.0.3
Log Directory Writable: ✔
WP Version: 5.4
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_US
External object cache: ✔

### Server Environment ###

Server Info: nginx
PHP Version: 7.3.16
PHP Post Max Size: 2 GB
PHP Time Limit: 1200
PHP Max Input Vars: 6144
cURL Version: 7.69.1
OpenSSL/1.1.1d

SUHOSIN Installed: –
MySQL Version: 5.5.5-10.3.22-MariaDB-log
Max Upload Size: 2 GB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

### Database ###

WC Database Version: 4.1.0
WC Database Prefix: wp_
Total Database Size: 2.55MB
Database Data Size: 1.17MB
Database Index Size: 1.38MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_options: Data: 0.19MB + Index: 0.03MB + Engine InnoDB
wp_postmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_posts: Data: 0.08MB + Index: 0.06MB + Engine InnoDB
wp_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB

### Post Type Counts ###

attachment: 1
page: 26
post: 2
product: 6
product_variation: 7
revision: 39
scheduled-action: 4
shop_coupon: 1
shop_order: 4
shop_order_refund: 3

### Security ###

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

### Active Plugins (8) ###

Code Snippets: by Code Snippets Pro – 2.14.0
Debug Bar - Enable WP_DEBUG from admin dashboard: by Puvox.software – 1.82
Jetpack by WordPress.com: by Automattic – 8.4.2
WooCommerce Admin: by WooCommerce – 1.0.3 – Installed version not tested with active version of WooCommerce 4.1.0
WooCommerce Beta Tester: by WooCommerce – 2.0.1 – Installed version not tested with active version of WooCommerce 4.1.0
WooCommerce Stripe Gateway: by WooCommerce – 4.3.3 – Installed version not tested with active version of WooCommerce 4.1.0
WooCommerce Services: by Automattic – 1.23.0 – Installed version not tested with active version of WooCommerce 4.1.0
WooCommerce: by Automattic – 4.1.0-beta.2

### Inactive Plugins (1) ###

Akismet Anti-Spam: by Automattic – 4.1.4

### Dropin Plugins (2) ###

advanced-cache.php: advanced-cache.php
object-cache.php: Memcached

### Settings ###

API Enabled: –
Force SSL: –
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: –

### WC Pages ###

Shop base: #7 - /shop/
Cart: #8 - /cart/
Checkout: #9 - /checkout/
My account: #10 - /my-account/
Terms and conditions: ❌ Page not set

### Theme ###

Name: Storefront
Version: 2.5.3 (update to version 2.5.5 is available)
Author URL: https://woocommerce.com/
Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
WooCommerce Support: ✔

### Templates ###

Overrides: –

### Action Scheduler ###

Complete: 7
Oldest: 2020-04-11 00:14:51 +0000
Newest: 2020-04-15 18:07:00 +0000

Pending: 1
Oldest: 2020-04-15 18:36:18 +0000
Newest: 2020-04-15 18:36:18 +0000

Failed: 2
Oldest: 2019-12-27 13:07:11 +0000
Newest: 2020-04-15 18:05:14 +0000
@jrick1229
Copy link
Author

I thought this could be related to Gutenberg, but I'm seeing the same issue with the Classic Editor as well.

@tammullen tammullen added type: bug The issue is a confirmed bug. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. labels Apr 17, 2020
@tammullen
Copy link
Contributor

Hi @jrick1229

Thank you for taking the time reporting this bug, we really appreciate your help. I can reproduce it on my end.

Screenshot 2020-04-17 at 20 35 24
Screenshot_2020-04-17_at_20_35_09
Screenshot_2020-04-17_at_20_35_15

We won’t be able to include this fix in the upcoming release due to the lower priority of this issue compared to others reported. We’re going to add it to our backlog so we can include it in our planning for one of our future releases.

@juliaamosova juliaamosova added the focus: product Issues related to product or product page. label Apr 20, 2020
@mi5t4n
Copy link
Contributor

mi5t4n commented Apr 23, 2020

Hello @jrick1229 @tammullen,
I could not replicate the issue while using the classic editor. Initially, the issue persists while using classic editor also, but you need to make sure your shortcode( [product_page id="_"] ) is not surrounded by Gutenberg blocks.

The issue arises when you use the shortcode block to display the shortcode in Gutenberg
Screenshot-20200423231147-1230x458
.
While using the shortcode block to display shortcode, the problem persists.
Screenshot-20200423231345-897x329

The issue persists after installing the classic editor plugin as well.
Screenshot-20200423231552-805x295
Screenshot-20200423231345-897x329

But, when you remove the Gutenberg blocks code surrounding the shortcode, the issue vanishes.
Screenshot-20200423231716-816x562
Screenshot-20200423231750-816x286

The issue vanishes.
Screenshot-20200423231848-760x372

P.S. The issue also vanishes, while using Gutenberg editor, if you use the classic editor Gutenberg block instead of shortcode block.
Screenshot-20200423232100-1184x368
Screenshot-20200423231848-760x372

I think I have found the culprit, the culprit function may be do_blocks() and _restore_wpautop_hook() which removes and inserts back wpautop() .

  1. do_blocks()
  2. _restore_wpautop_hook()

@ObliviousHarmony ObliviousHarmony added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 21, 2022
@nerrad
Copy link
Contributor

nerrad commented Dec 5, 2023

I'm closing this issue since there is a workaround for folks who want to use this shortcode. Lower priority issues for shortcodes are not items that we will be working on given our focus is on providing robust blocks which should be a superior option for this use-case.

@nerrad nerrad closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: product Issues related to product or product page. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Kirigami & Origami WC Store Editing (FSE) type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

7 participants