-
Notifications
You must be signed in to change notification settings - Fork 88
Feature/daniele/checkout custom parameters #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Feature/daniele/checkout custom parameters #819
Conversation
6ab27a1
to
b394995
Compare
protected $_checkout_config = []; | ||
|
||
/** | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra Spaces
switch ($type) | ||
{ | ||
case 'bool': | ||
if (is_bool($value)) |
There was a problem hiding this comment.
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() | ||
{ |
There was a problem hiding this comment.
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'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanieleAlessandra Please check this out:
https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#declaring-arrays
Long array syntax.
This PR introduces support for additional checkout configuration properties in the SDK initializer.
What’s new
The following properties are now recognized during initialization:
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.