Skip to content

Conversation

DanieleAlessandra
Copy link
Collaborator

This PR introduces support for additional checkout configuration properties in the SDK initializer.

What’s new

The following properties are now recognized during initialization:

// currency
'currency'                      => 'string',
'default_currency'              => 'string',
// cart
'always_show_renewals_amount'   => 'bool',
'annual_discount'               => 'bool',
'billing_cycle'                 => ['string', 'int'],
'bundle_discount'               => 'float',
'maximize_discounts'            => 'bool',
'multisite_discount'            => ['bool', 'string'], // string expected to be "auto"
'show_inline_currency_selector' => 'bool',
'show_monthly'                  => 'bool',
// appearance
'form_position'                 => 'string',
'is_bundle_collapsed'           => 'bool',
'layout'                        => 'string',
'refund_policy_position'        => 'string',
'show_refund_badge'             => 'bool',
'show_reviews'                  => 'bool',
'show_upsells'                  => 'bool',
'title'                         => 'string',

Behavior
• If these properties exist in the initialization config, they are validated and stored.
• When opening the checkout (both iframe and redirect modes), the provided values are automatically passed along to the checkout context.

This allows developers to customize the checkout flow appearance and cart behavior more flexibly directly from the SDK initialization.

@DanieleAlessandra DanieleAlessandra force-pushed the feature/daniele/checkout-custom-parameters branch from 6ab27a1 to b394995 Compare September 15, 2025 16:13
protected $_checkout_config = [];

/**

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieleAlessandra An extra line.

*
* @return array
*/
protected function validate_checkout_config($config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieleAlessandra Missing spaces around $config.


$result = array();

foreach ($schema as $key => $expected_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieleAlessandra Please check the spaces.


foreach ($schema as $key => $expected_type)
{
if (array_key_exists($key, $config))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch ($type)
{
case 'bool':
if (is_bool($value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieleAlessandra Curly braces

* @return array
*/
public function get_checkout_config()
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanieleAlessandra Curly braces :)

// cart
'always_show_renewals_amount' => 'bool',
'annual_discount' => 'bool',
'billing_cycle' => ['string', 'int'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants