Changeset 2767893
- Timestamp:
- 08/08/2022 02:10:01 PM (4 years ago)
- Location:
- shelfy-mobile-commerce-platform
- Files:
-
- 27 added
- 1 deleted
- 3 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/LICENSE.txt (added)
-
tags/1.0.1/README.txt (added)
-
tags/1.0.1/admin (added)
-
tags/1.0.1/admin/scripts (added)
-
tags/1.0.1/admin/scripts/plugins.js (added)
-
tags/1.0.1/assets (added)
-
tags/1.0.1/assets/Montserrat-Regular.ttf (added)
-
tags/1.0.1/assets/Montserrat-SemiBold.ttf (added)
-
tags/1.0.1/assets/icon-big.png (added)
-
tags/1.0.1/assets/icon-menu.png (added)
-
tags/1.0.1/assets/icon.png (added)
-
tags/1.0.1/assets/related.svg (added)
-
tags/1.0.1/assets/woocommerce-logo.png (added)
-
tags/1.0.1/changelog.txt (added)
-
tags/1.0.1/includes (added)
-
tags/1.0.1/includes/class-shelfy-cart-item-schema-ex.php (added)
-
tags/1.0.1/includes/class-shelfy.php (added)
-
tags/1.0.1/includes/controllers (added)
-
tags/1.0.1/includes/controllers/class-shelfy-cart-rest-api.php (added)
-
tags/1.0.1/includes/controllers/class-shelfy-cart-v2-rest-api.php (added)
-
tags/1.0.1/includes/controllers/class-shelfy-customer-rest-api.php (added)
-
tags/1.0.1/includes/controllers/class-shelfy-integration-rest-api.php (added)
-
tags/1.0.1/includes/webhooks (added)
-
tags/1.0.1/includes/webhooks/webhooks-category.php (added)
-
tags/1.0.1/shelfy.php (added)
-
tags/1.0.1/uninstall.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/changelog.txt (deleted)
-
trunk/includes/controllers/class-shelfy-cart-rest-api.php (modified) (5 diffs)
-
trunk/shelfy.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shelfy-mobile-commerce-platform/trunk/README.txt
r2767403 r2767893 1 === Shelfy - Mobile App Builder ===1 === Shelfy - Mobile App Builder - Dev === 2 2 Contributors: itziksn 3 3 Tags: woocommerce, mobile, application, android, ios 4 4 Requires at least: 5.8 5 5 Tested up to: 6.0 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
shelfy-mobile-commerce-platform/trunk/includes/controllers/class-shelfy-cart-rest-api.php
r2767340 r2767893 169 169 $batch_response = array(); 170 170 foreach ( $requests as $index => $request ) { 171 $response = $this->update_item_quantity( $request );171 $response = $this->update_item_quantity( $request, true ); 172 172 if ( is_wp_error( $response ) ) { 173 173 $batch_response[] = array( … … 198 198 $batch_errors = array(); 199 199 foreach ( $products as $index => $product ) { 200 $response = $this->update_item_quantity( $product );200 $response = $this->update_item_quantity( $product, true ); 201 201 if ( is_wp_error( $response ) ) { 202 202 $batch_errors[] = array( … … 220 220 * 221 221 * @param WP_REST_Request $request The HTTP request object. 222 */ 223 public function update_item_quantity( $request ) { 222 * @param bool $add_always whether to always add the quantity requsted, regardless of whether the exact item present in the cart already. 223 */ 224 public function update_item_quantity( $request, $add_always = false ) { 224 225 $product_id = $request['productId']; 225 226 $variant_id = $request['variantId']; 226 227 $quantity = $request['quantity']; 228 $attribues = array(); 229 if ( isset( $request['dynamicAttributes'] ) ) { 230 $attribues['shelfy_dynamic_attributes'] = $request['dynamicAttributes']; 231 } 227 232 $cart = WC()->cart; 228 233 $product = wc_get_product( $product_id ); … … 242 247 } 243 248 $variations = wc_get_product_variation_attributes( $variant_id ); 244 $cart_id = $cart->generate_cart_id( $product_id, $variant_id, $variations ); 245 $cart_id = $cart->find_product_in_cart( $cart_id ); 246 if ( ! empty( $cart_id ) ) { 247 $cart->set_quantity( $cart_id, $quantity ); 249 if ( !$add_always ) { 250 $cart_id = $cart->generate_cart_id( $product_id, $variant_id, $variations, $attribues ); 251 $cart_id = $cart->find_product_in_cart( $cart_id ); 252 } 253 if ( ! empty( $cart_id ) && ! $add_always ) { 254 if ( 0.0 === (float)$quantity ) { 255 $cart->remove_cart_item( $cart_id ); 256 } else { 257 $cart->set_quantity( $cart_id, $quantity ); 258 } 248 259 } elseif ( $quantity > 0 ) { 249 260 try { 250 if ( ! $cart->add_to_cart( $product_id, $quantity, $variant_id ) ) {261 if ( ! $cart->add_to_cart( $product_id, $quantity, $variant_id, $variations, $attribues ) ) { 251 262 $notices = WC()->session->get( 'wc_notices' ); 252 263 if ( $notices && isset( $notices['error'] ) ) { … … 281 292 'required' => false, 282 293 ), 294 'dynamicAttributes' => array( 295 'type' => 'object', 296 'required' => false, 297 ) 283 298 ); 284 299 } -
shelfy-mobile-commerce-platform/trunk/shelfy.php
r2767401 r2767893 7 7 * Plugin Name: Shelfy - Mobile App Builder 8 8 * Description: Build fast mobile apps that you control — no coding is required. 9 * Version: 1.0. 010 * Stable tag: 1.0. 09 * Version: 1.0.1 10 * Stable tag: 1.0.1 11 11 * WC requires at least: 5.0 12 12 * WC tested up to: 6.7 … … 24 24 } 25 25 26 define( 'SHELFY_VERSION', '1.0. 0' );26 define( 'SHELFY_VERSION', '1.0.1' ); 27 27 define( 'SHELFY_MAIN_PLUGIN_FILE', __FILE__ ); 28 28 define( 'SHELFY_REQUIRED_WOOCOMMERCE_VERSION', '5.8.0' );
Note: See TracChangeset
for help on using the changeset viewer.