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
Marketing: Do not show "Create a campaign" button if there are no campaign types #38825
Conversation
Hi , @woocommerce/ventures, @woocommerce/automata Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
1 similar comment
Hi , @woocommerce/ventures, @woocommerce/automata Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
Test Results SummaryCommit SHA: 04294c4
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
...merce-admin/client/marketing/overview-multichannel/IntroductionBanner/IntroductionBanner.tsx
Outdated
Show resolved
Hide resolved
...merce-admin/client/marketing/overview-multichannel/IntroductionBanner/IntroductionBanner.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have left one comment for the comment copy and one comment for the logic. It works if you disregard the comment so it is up to you if you want to use it. Either way approving. Nice change!
Submission Review Guidelines:
Changes proposed in this Pull Request:
Closes #38805.
In this PR, we add conditions for rendering the "Create a campaign" button in the Introduction Banner card:
I also added code for the "Create new campaign" button in the "Campaigns" card, so that "Create new campaign" button will not be shown when there are no campaign types. See the example screenshot below. Note that currently the "Campaigns" card is not displayed when there are no campaign types; this is because there is no match between the supported campaign types and the campaign types in the marketing campaigns, and the
GET /marketing/campaigns
API call returns an error instead of campaigns data. The code added is for "future proofing" just in case.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Note: to test the changes, you may need to use some test data in some marketing channel extension. The following is an example of how to do that using Google Listings and Ads:
get_campaigns
function in https://github.com/woocommerce/google-listings-and-ads/blob/33243ae88cf0b930d9956903738ececb5069a11e/src/MultichannelMarketing/GLAChannel.php#LL178C42-L178C42, so that it returns some sample marketing campaigns:generate_campaign_types
function in https://github.com/woocommerce/google-listings-and-ads/blob/33243ae88cf0b930d9956903738ececb5069a11e/src/MultichannelMarketing/GLAChannel.php#L213-L224, so that it returns empty array for campaign types:Test Steps:
/wp-admin/admin.php?page=wc-admin&path=%2Fmarketing
generate_campaign_types
, you should see "Create a campaign" button in the introduction banner, and you should see "Create a campaign" button in the "Campaigns" card.generate_campaign_types
function to return empty array. You should NOT see "Create a campaign" button in the introduction banner. The "Campaigns" card should not be shown. In the browser network panel, you should see an error for theGET /marketing/campaigns
API call.