Skip to content

Conversation

@anaemnesis
Copy link
Contributor

@anaemnesis anaemnesis commented Jan 6, 2026

Fixes SEARCH-112

Proposed changes:

This PR adds a new Show prices toggle alongside the existing Customize Jetpack Search options, which only shows when the Instant Search "Result Format" is set to "Product".

This option is needed for stores based in countries where VAT must be incorporated into display prices. As this is not possible with Instant Search at present, adding an option to hide the price from results is a necessary compromise.

New Option

CleanShot 2026-01-06 at 14 49 24

Prices enabled

CleanShot 2026-01-06 at 14 50 01

Prices disabled

CleanShot 2026-01-06 at 14 47 55

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

No

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • In WP Admin, navigate to /wp-admin/admin.php?page=jetpack-search-configure.
  • Ensure "Product (for WooCommerce Stores)" is the selected "RESULT FORMAT" setting.
  • In the Additional Settings area at the bottom of the Options siebar, toggle/save the Show Prices option.
  • When disabled, prices should not show in the Customizer Preview or in results.
  • When enabled, prices should display in the Customizer Preview and results.

These changes add a new toggle to the Jetpack Search Customizer screen.
This new toggle, "Show price', allows the product price to be hidden when
Jetpack Instant Search is configured with the "Product (for WooCommerce Stores)"
result format. This is necessary to hide prices for users in countries where
prices must be shown with VAT integrated into them. At present, Instant Search
does not have the ability to show prices with VAT in Instant Search results.
@anaemnesis anaemnesis self-assigned this Jan 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the enhance/allow-hiding-price branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack enhance/allow-hiding-price

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Package] Search Contains core Search functionality for Jetpack and Search plugins [Status] In Progress labels Jan 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • 🔴 Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jan 6, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Jan 6, 2026

Code Coverage Summary

Coverage changed in 4 files.

File Coverage Δ% Δ Uncovered
projects/packages/search/src/customizer/class-customizer.php 0/302 (0.00%) 0.00% 19 💔
projects/packages/search/src/class-settings.php 0/30 (0.00%) 0.00% 1 ❤️‍🩹
projects/packages/search/src/customberg/hooks/use-search-options.js 0/23 (0.00%) 0.00% 1 ❤️‍🩹
projects/packages/search/src/class-helper.php 307/373 (82.31%) 0.05% 0 💚

Full summary · PHP report · JS report

Coverage check overridden by Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR .

@anaemnesis anaemnesis added the Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR label Jan 6, 2026
@anaemnesis anaemnesis marked this pull request as ready for review January 6, 2026 15:04
Copilot AI review requested due to automatic review settings January 6, 2026 15:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new "Show price" toggle to Jetpack Instant Search, allowing WooCommerce store owners to hide product prices from search results. This is particularly useful for stores in regions where VAT must be incorporated into displayed prices, which isn't currently supported by Instant Search.

Key Changes

  • Adds a new jetpack_search_show_product_price setting with a default value of enabled (true)
  • Conditionally renders the ProductPrice component in search results based on the new setting
  • Provides UI controls in both WordPress Customizer and Customberg sidebar for toggling price visibility

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/packages/search/src/instant-search/lib/customize.js Maps the new setting to JavaScript state for customizer integration
projects/packages/search/src/instant-search/components/search-results.jsx Passes the showProductPrice prop to search result components
projects/packages/search/src/instant-search/components/search-result-product.jsx Conditionally renders ProductPrice component based on the new prop
projects/packages/search/src/instant-search/components/search-app.jsx Passes the enableProductPrice state to the overlay SearchResults
projects/packages/search/src/customizer/class-customizer.php Registers the customizer control for the "Show price" toggle
projects/packages/search/src/customberg/hooks/use-search-options.js Adds entity prop hooks for reading/writing the productPrice setting
projects/packages/search/src/customberg/components/sidebar/sidebar-options.jsx Adds UI toggle control, conditionally shown only for product format
projects/packages/search/src/customberg/components/app-wrapper/index.jsx Maps productPrice option to overlay state for preview
projects/packages/search/src/class-settings.php Registers the new setting with REST API support
projects/packages/search/src/class-helper.php Includes enableProductPrice in initial JavaScript state generation
projects/packages/search/changelog/enhance-allow-hiding-price Documents the new feature as a minor enhancement

array( $setting_prefix . 'inf_scroll', 'boolean', true ),
array( $setting_prefix . 'filtering_opens_overlay', 'boolean', true ),
array( $setting_prefix . 'show_post_date', 'boolean', true ),
array( $setting_prefix . 'show_product_price', 'boolean', true ),
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

As noted in the class documentation above (lines 18-19), this new setting must be added to the Jetpack sync configuration and whitelisted on WPCOM. Ensure that jetpack_search_show_product_price is added to Automattic\Jetpack\Sync\Modules\Search::$options_to_sync and is properly whitelisted and sanitized on WPCOM as mentioned in reference PCYsg-sBM-p2.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure on this, as filtering_opens_overlay and show_post_date are not included in the sync array. I've followed the pattern for show_post_date and as it wasn't included, I haven't included this either. If this is an oversight between the two locations this PR should be fine to address that.

private static $options_to_sync = array(

Comment on lines +316 to +323
$wp_customize->add_control(
$id,
array(
'type' => 'checkbox',
'section' => $section_id,
'label' => __( 'Show price', 'jetpack-search-pkg' ),
)
);
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The "Show price" control is always visible in the WordPress Customizer regardless of the selected result format, but it only has an effect when the result format is set to "Product". Consider adding an active_callback to the control configuration to conditionally show this control only when the result format is "product", similar to how it's conditionally shown in the Customberg sidebar (sidebar-options.jsx lines 157-166). This would improve the user experience by avoiding confusion about when this setting applies.

Note: The existing "Show post date" control (lines 285-303) has the same pattern where it's always visible but only relevant for the "expanded" format, so this is consistent with the current codebase. However, adding conditional visibility for both controls would be a worthwhile improvement.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR [Package] Search Contains core Search functionality for Jetpack and Search plugins [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants