Skip to content

Add logging for coupon in checkout#3279

Closed
ajello-meta wants to merge 3 commits intomainfrom
checkout-coupon-logging
Closed

Add logging for coupon in checkout#3279
ajello-meta wants to merge 3 commits intomainfrom
checkout-coupon-logging

Conversation

@ajello-meta
Copy link
Copy Markdown
Contributor

Description

This PR adds logging for coupon codes in Checkout.php. The WC()->cart->apply_coupon( $coupon_code ) function does not throw an exception when the coupon is invalid. The updated logic adds a conditional check that verifies the coupon is correctly applied to the cart, or logs the error if not correctly applied to the cart.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Test Plan

  1. Go to http://test-site-i.local/fb-checkout?products=<ID>:<#>&coupon=<code>. Fill in the "ID" and/or "#" with valid inputs. Fill in "code" with an invalid input.
  2. Check Meta side logging to ensure that the error logs are visible for flow_name=checkout and flow_step=apply_coupon.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ajello-meta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Latest Plugin Build

Built at: 2025-05-29T23:51:07.648Z
Commit: 1f37eb8
Size: 1.1M

Download: Click here to download the plugin

To download: Click the link above → Scroll to bottom → Download "facebook-for-woocommerce" artifact

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ajello-meta merged this pull request in 36cbefd.

@tzahgr tzahgr mentioned this pull request Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants