Skip to content

Commit

Permalink
Use the correct value for free shipping minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
JPry committed Mar 8, 2021
1 parent 0832ccb commit 824253e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/API/Google/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ protected function has_free_shipping_option(): bool {
);
}

/**
* Get the free shipping minimum order value.
*
* @return int
*/
protected function get_free_shipping_minimum(): int {
return intval(
$this->get_options_object()->get( OptionsInterface::MERCHANT_CENTER )['free_shipping_threshold']
);
}

/**
* @return OptionsInterface
*/
Expand Down Expand Up @@ -268,7 +279,7 @@ protected function create_main_service( string $country, string $currency, $rate
*/
protected function create_free_shipping_service( string $country, string $currency ): Service {
$price = new Price();
$price->setValue( 0 );
$price->setValue( $this->get_free_shipping_minimum() );
$price->setCurrency( $currency );

$service = $this->create_main_service( $country, $currency, 0 );
Expand Down

0 comments on commit 824253e

Please sign in to comment.