Can’t add custom metadata
-
Hi, I am trying to add custom metadata, following https://woocommerce.com/document/stripe/customization/products-as-metadata/
However, the filter is never applied. Any clue?
Here is my filter:
add_filter( 'wc_stripe_intent_metadata', 'add_custom_stripe_metadata', 50, 2 );
function add_custom_stripe_metadata( $metadata, $order, $prepared_source = null ) {
error_log("--- add_custom_stripe_metadata, order: " . $order->get_id());
// Add name, quantity, and price for each line item.
$count = 1;
foreach ( $order->get_items() as $item_id => $line_item ) {
$product = $line_item->get_product();
$product_sku = $product->get_sku();
error_log("--- add_custom_stripe_metadata, sku: " . $product_sku);
$metadata['sku' . $count] = $product_sku;
$count += 1;
}
return $metadata;
}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.