Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ public function save_product_variation_edit_fields( $variation_id, $index ) {
}

// ALWAYS save Facebook field data (this fixes the PR #2931 breaking change)
$posted_param = 'variable_' . \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION;
$posted_param = 'variable_' . \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION;
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Intentionally getting raw value to apply different sanitization methods below
$description_raw = isset( $_POST[ $posted_param ][ $index ] ) ? wp_unslash( $_POST[ $posted_param ][ $index ] ) : null;

Expand Down
22 changes: 21 additions & 1 deletion includes/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,27 @@ public function load_checkout_permalink_template( $template ) {

$coupon_code = get_query_var( 'coupon' );
if ( $coupon_code ) {
WC()->cart->apply_coupon( sanitize_text_field( $coupon_code ) );
$coupon_code_sanitized = sanitize_text_field( $coupon_code );
WC()->cart->apply_coupon( $coupon_code_sanitized );

if ( ! in_array( $coupon_code_sanitized, WC()->cart->get_applied_coupons(), true ) ) {
$error_message = sprintf(
'Failed to apply coupon: %s',
$coupon_code_sanitized
);

\WC_Facebookcommerce_Utils::log_to_meta(
$error_message,
array(
'flow_name' => 'checkout',
'flow_step' => 'apply_coupon',
'extra_data' => [
'coupon_param' => $coupon_code,
'coupon_code' => $coupon_code_sanitized,
],
)
);
}
}

$checkout_url = wc_get_checkout_url();
Expand Down