From b925c78701c32d0dc90d9455e39e01298932af9d Mon Sep 17 00:00:00 2001 From: Falko Joseph Date: Fri, 12 Apr 2024 10:46:14 +0200 Subject: [PATCH] feat: added price guarantee + inventory report --- modules/fields/class-price.php | 40 +++++++++++++++++++++++++++ modules/update/class-price-update.php | 14 ++++++++++ wp-sweepbright.php | 4 +-- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/modules/fields/class-price.php b/modules/fields/class-price.php index 0b2d66de..ec7b0be2 100644 --- a/modules/fields/class-price.php +++ b/modules/fields/class-price.php @@ -210,6 +210,46 @@ public static function retrieve() 'name' => 'custom_price', 'type' => 'text', ], + [ + 'key' => 'price_inventory_report_cost', + 'label' => 'Price inventory report cost', + 'name' => 'price_inventory_report_cost', + 'type' => 'group', + 'sub_fields' => [ + [ + 'key' => 'amount', + 'label' => 'Amount', + 'name' => 'amount', + 'type' => 'number', + ], + [ + 'key' => 'currency', + 'label' => 'Currency', + 'name' => 'currency', + 'type' => 'text', + ], + ], + ], + [ + 'key' => 'price_guarantee', + 'label' => 'Price guarantee', + 'name' => 'price_guarantee', + 'type' => 'group', + 'sub_fields' => [ + [ + 'key' => 'amount', + 'label' => 'Amount', + 'name' => 'amount', + 'type' => 'number', + ], + [ + 'key' => 'currency', + 'label' => 'Currency', + 'name' => 'currency', + 'type' => 'text', + ], + ], + ], ], ]; } diff --git a/modules/update/class-price-update.php b/modules/update/class-price-update.php index 661d85af..4db1a26a 100644 --- a/modules/update/class-price-update.php +++ b/modules/update/class-price-update.php @@ -94,5 +94,19 @@ public static function update($estate, $post_id) update_field('price', [ 'custom_price' => $estate['custom_price'], ], $post_id); + + update_field('price', [ + 'price_inventory_report_cost' => [ + 'amount' => $estate['price_inventory_report_cost']['amount'], + 'currency' => $estate['price_inventory_report_cost']['currency'], + ], + ], $post_id); + + update_field('price', [ + 'price_guarantee' => [ + 'amount' => $estate['price_guarantee']['amount'], + 'currency' => $estate['price_guarantee']['currency'], + ], + ], $post_id); } } diff --git a/wp-sweepbright.php b/wp-sweepbright.php index 8187e9a8..e02861f0 100644 --- a/wp-sweepbright.php +++ b/wp-sweepbright.php @@ -10,7 +10,7 @@ * Author: Compagnon Agency * Author URI: https://compagnon.agency/ * Text Domain: wp-sweepbright - * Version: 2.11.0 + * Version: 2.12.0 */ // If this file is called directly, abort. @@ -23,7 +23,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define('WP_SWEEPBRIGHT_VERSION', '2.11.0'); +define('WP_SWEEPBRIGHT_VERSION', '2.12.0'); /** * The code that runs during plugin activation.