woocommerce/plugins/woocommerce
Gan Eng Chin 6802b2720a
Add Default Fallback Marketing Channel Recommendations (#43001)
* Add MarketingRecommendations feature.

The code here is based on other feature with default fallbacks and with data source poller, e.g. see payment gateway suggestions.

* Use MarketingRecommendations feature in API.

* Add spec_key for MarketingRecommendationsDataSourcePoller.

If we don't specify it, the default is `id`, which is not used in our recommendation data, and this will cause things not to work as expected.

* Recursively convert object to array.

This is because all the subsequent functions work with arrays, not objects.

* Make recommended marketing tools and coupons use MarketingRecommendationsInit.

This is so that recommended channels, tools, and coupons make use of the same transient data with data source poller.

* Add changelog.

* Fix PHP lint issues.

* Add doc comment to fix lint error.

* Fix tests in MarketingRecommendationsTest.

* Replace recommendations.json file with generated data in DefaultMarketingRecommendations.

This is to have i18n support.

* Add icons for fallback marketing recommendations.

* Fix PHP linting issue.

* Fix linting issue.

* Fix failing tests with PHP 8.0.

* Remove unused replaced code in MarketingSpecs.

* Remove unneeded false check.

This is because `is_array` would return `false` when `false` is being passed as the argument.

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>

---------

Co-authored-by: Bartosz Budzanowski <bartosz.budzanowski@automattic.com>
2024-01-10 18:39:59 +08:00
..
.wordpress-org
assets Add Default Fallback Marketing Channel Recommendations (#43001) 2024-01-10 18:39:59 +08:00
bin Remove v1 of plugin installer (#37893) 2024-01-09 09:23:13 +00:00
changelog Add Default Fallback Marketing Channel Recommendations (#43001) 2024-01-10 18:39:59 +08:00
client Logging: Add settings UI to configure the logger (#42979) 2024-01-10 14:44:05 +05:30
i18n Update state definitions for Liechtenstein and Chile (#41068) 2023-11-01 05:37:22 -07:00
includes Add Default Fallback Marketing Channel Recommendations (#43001) 2024-01-10 18:39:59 +08:00
lib Re-add "mobiledetect/mobiledetectlib" library 2023-11-27 18:59:10 +01:00
packages remove superfluous "here" 2023-11-10 15:49:08 +01:00
patterns CYS: fix PHP warnings and pattern button (#43354) 2024-01-10 09:03:56 +01:00
sample-data update references to woocommerce.com to now reference woo.com 2023-11-10 15:49:08 +01:00
src Add Default Fallback Marketing Channel Recommendations (#43001) 2024-01-10 18:39:59 +08:00
templates Make OSA fields extendable, simplify naming (#41690) 2024-01-08 16:17:04 +01:00
tests Add Default Fallback Marketing Channel Recommendations (#43001) 2024-01-10 18:39:59 +08:00
.distignore Try reducing blocks build size (#43344) 2024-01-08 11:33:49 -06:00
.eslintignore
.eslintrc.js
.gitattributes
.gitignore Fixed Blocks INI File Path 2023-12-09 21:33:34 -08:00
.wp-env.json Add tests for analytics (orders) (#40504) 2023-11-22 15:42:36 +08:00
NEXT_CHANGELOG.md
README.md Merge branch 'trunk' into refactor/task-infrastructure 2023-12-09 21:51:43 -08:00
composer.json Prep trunk for 8.6 cycle (#43021) 2023-12-22 09:27:54 +01:00
composer.lock Update Action Scheduler to 3.7.1 2023-12-14 12:56:05 +00:00
license.txt
package.json Fix @woocommerce/block-templates changes not being picked up on build (#43328) 2024-01-05 11:44:25 -05:00
phpcs.xml Disable `DisallowShortArraySyntax` and `InternalInjectionMethod` sniffs for blocks files. (#42863) 2023-12-15 12:39:31 +01:00
phpunit.xml Autoload test helpers and exclude from test suites. (#39586) 2023-08-09 15:48:04 -03:00
readme.txt Update stable tag to 8.4.0 (#43425) 2024-01-09 16:51:08 +01:00
tsconfig.json
uninstall.php
woocommerce.php Prep trunk for 8.6 cycle (#43021) 2023-12-22 09:27:54 +01:00

README.md

WooCommerce

License WordPress.org downloads WordPress.org rating Build Status codecov

This is the WooCommerce Core plugin. Here you can browse the source and keep track of development. We recommend all developers to follow the WooCommerce development blog to stay up to date about everything happening in the project. You can also follow @DevelopWC on Twitter for the latest development updates.

If you are not a developer, please use the WooCommerce plugin page on WordPress.org.

Getting Started

Please make sure you follow the repository's getting started guide first!

# Make sure that WooCommerce Core and all of its dependencies are built
pnpm --filter=@woocommerce/plugin-woocommerce build 
# Make sure you're in the WooCommerce Core directory
cd plugins/woocommerce
# Start the development environment
pnpm -- wp-env start

You should now be able to visit http://localhost:8888/ and access WooCommerce environment.

Building Components

There are two major client-side components included in WooCommerce Core that can be built, linted, and tested independently. We've organized these components in this way to take advantage of caching to prevent unnecessarily performing expensive rebuilds when only working in one of them.

plugins/woocommerce/client/legacy

This directory contains the Classic CSS and jQuery code for WooCommerce.

# Build the assets.
pnpm --filter=@woocommerce/classic-assets build 
# Lint the assets.
pnpm --filter=@woocommerce/classic-assets lint 

plugins/woocommerce-admin

This directory contains the React-based admin interface.

# Build the React-based admin client.
pnpm --filter=@woocommerce/admin-library build 
# Lint the React-based admin client.
pnpm --filter=@woocommerce/admin-library lint 
# Test the React-based admin client.
pnpm --filter=@woocommerce/admin-library test 

plugins/woocommerce-blocks

This directory contains the client for WooCommerce + Gutenberg.

# Build the Blocks client.
pnpm run --filter=@woocommerce/block-library build 
# Lint the Blocks client.
pnpm run --filter=@woocommerce/block-library lint 
# Test the Blocks client.
pnpm run --filter=@woocommerce/block-library test 

Helper Scripts

Here is a collection of scripts that can help when developing the React-based admin interface.

# Create a develoment build of the React-based admin client.
pnpm --filter=@woocommerce/admin-library dev 
# Create and watch a development build of the React-based admin client.
pnpm --filter=@woocommerce/admin-library start 
# Watch the tests of the React-based admin client.
pnpm --filter=@woocommerce/admin-library test:watch 
# Run a type check over the React-based admin client's TypeScript files.
pnpm --filter=@woocommerce/admin-library ts:check 

Documentation

Reporting Security Issues

To disclose a security issue to our team, please submit a report via HackerOne here.