Open
Description
This endpoint : ecommerce/stores/{store_id}/promo-rules
Params: enabled
Need to be boolean. This crash because craft\commerce\models\Discount->enabled return a string and Mailchimp API claims that the type should be a boolean.
Here my fix:
/src/craftCMS/vendor/ether/mailchimp-commerce/src/services/PromosService.php
private function _buildPromoData($promoId){
...
$data = [
'id' => (string) $promo->id,
'title' => $promo->name,
'description' => $promo->description ?: $promo->name,
'amount' => (float) $amount,
'type' => $type,
'target' => $target,
'enabled' => filter_var($promo->enabled, FILTER_VALIDATE_BOOLEAN),
'created_at_foreign' => $promo->dateCreated->format('c'),
'updated_at_foreign' => $promo->dateUpdated->format('c'),
];
...
}
filter_var($promo->enabled, FILTER_VALIDATE_BOOLEAN)
Metadata
Metadata
Assignees
Labels
No labels