Changeset 2309299
- Timestamp:
- 05/21/2020 07:57:04 AM (6 years ago)
- Location:
- mobile-builder/trunk
- Files:
-
- 2 edited
-
api/class-mobile-builder-cart.php (modified) (5 diffs)
-
includes/class-mobile-builder.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mobile-builder/trunk/api/class-mobile-builder-cart.php
r2307562 r2309299 199 199 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $_product->get_id() ), 'single-post-thumbnail' ); 200 200 if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 ) { 201 202 if ( WC()->cart->display_prices_including_tax() ) { 203 $product_price = wc_get_price_including_tax( $_product ); 204 } else { 205 $product_price = wc_get_price_excluding_tax( $_product ); 206 } 207 201 208 $items[ $cart_item_key ]['thumbnail'] = $_product->get_image(); 202 209 $items[ $cart_item_key ]['thumb'] = $image[0]; 203 210 $items[ $cart_item_key ]['is_sold_individually'] = $_product->is_sold_individually(); 204 211 $items[ $cart_item_key ]['name'] = $_product->get_name(); 205 $items[ $cart_item_key ]['price'] = WC()->cart->get_product_price( $_product ); 212 $items[ $cart_item_key ]['price'] = $product_price; 213 $items[ $cart_item_key ]['price_html'] = WC()->cart->get_product_price( $_product ); 206 214 $items[ $cart_item_key ]['vendor_id'] = $vendor_id; 207 215 $items[ $cart_item_key ]['store'] = $vendor_id ? $store_user = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ) : null; … … 211 219 212 220 return array( 213 'items' => $items, 214 'totals' => WC()->cart->get_totals(), 221 'items' => $items, 222 'totals' => WC()->cart->get_totals(), 223 'coupons' => WC()->cart->get_applied_coupons(), 215 224 ); 216 225 } … … 395 404 wp_send_json( 396 405 array( 397 'result' => empty( $messages ) ? 'success' : 'failure', 398 'messages' => $messages, 399 'reload' => $reload_checkout, 400 'nonce' => wp_create_nonce( 'woocommerce-process_checkout' ), 401 'fragments' => apply_filters( 402 'woocommerce_update_order_review_fragments', 403 array( 404 '.woocommerce-checkout-review-order-table' => $woocommerce_order_review, 405 '.woocommerce-checkout-payment' => $woocommerce_checkout_payment, 406 ) 407 ), 406 'result' => empty( $messages ) ? 'success' : 'failure', 407 'messages' => $messages, 408 'reload' => $reload_checkout, 409 'nonce' => wp_create_nonce( 'woocommerce-process_checkout' ), 410 'totals' => WC()->cart->get_totals(), 408 411 ) 409 412 ); 410 413 } 411 414 415 /** 416 * 417 * Checkout progress 418 * 419 * @throws Exception 420 */ 412 421 public function mobile_builder_checkout() { 413 414 422 wc_maybe_define_constant( 'WOOCOMMERCE_CHECKOUT', true ); 423 wc_maybe_define_constant( 'DOING_AJAX', true ); 415 424 WC()->checkout()->process_checkout(); 416 425 wp_die( 0 ); … … 423 432 */ 424 433 public function shipping_methods() { 425 426 // global $woocommerce;427 428 // WC()->customer->set_props(429 // array(430 // 'shipping_country' => 'VE',431 // 'shipping_state' => $request->get_param( 'state') ) ? wc_clean( wp_unslash( $request->get_param( 'state') ) ) : null,432 // 'shipping_postcode' => $request->get_param( 'postcode') ) ? wc_clean( wp_unslash( $request->get_param( 'postcode') ) ) : null,433 // 'shipping_city' => $request->get_param( 'city') ) ? wc_clean( wp_unslash( $request->get_param( 'city') ) ) : null,434 // 'shipping_address_1' => $request->get_param( 'address') ) ? wc_clean( wp_unslash( $request->get_param( 'address') ) ) : null,435 // 'shipping_address_2' => $request->get_param( 'address_2') ) ? wc_clean( wp_unslash( $request->get_param( 'address_2') ) ) : null,436 // )437 // );438 439 // $data = 'billing_first_name=&billing_last_name=&billing_company=&billing_country=VE&billing_address_1=&billing_address_2=&billing_city=&billing_state=&billing_postcode=&billing_phone=&billing_email=admin%40gmail.com&shipping_first_name=&shipping_last_name=&shipping_company=&shipping_country=VN&shipping_address_1=&shipping_address_2=&shipping_postcode=&shipping_city=&shipping_state=&order_comments=&shipping_method%5B15%5D=free_shipping%3A3&shipping_method%5B18%5D=free_shipping%3A3&payment_method=bacs&woocommerce-process-checkout-nonce=a1194af571&_wp_http_referer=%2Fwpdev%2F%3Fwc-ajax%3Dupdate_order_review';440 //441 //442 // do_action( 'woocommerce_checkout_update_order_review', isset( $data ) ? wp_unslash( $data ) : '' );443 444 // WC()->customer->save();445 434 446 435 // Calculate shipping before totals. This will ensure any shipping methods that affect things like taxes are chosen prior to final totals being calculated. Ref: #22708. … … 463 452 $product_names = apply_filters( 'woocommerce_shipping_package_details_array', $product_names, $package ); 464 453 } 465 466 // print_r($package['rates']['flat_rate:2']->get_label()); die;467 468 // $rate = $package['rates'][ ];469 470 // echo $rate->get_label();471 454 472 455 $available_methods = array(); -
mobile-builder/trunk/includes/class-mobile-builder.php
r2307562 r2309299 208 208 // Cart 209 209 $plugin_cart = new Mobile_Builder_Cart( $this->get_plugin_name(), $this->get_version() ); 210 $this->loader->add_action( 'rest_api_init', $plugin_cart, 'add_api_routes', 10 ); 210 211 $this->loader->add_action( 'wp_loaded', $plugin_cart, 'mobile_builder_pre_car_rest_api', 5 ); 211 $this->loader->add_action( 'rest_api_init', $plugin_cart, 'add_api_routes', 10 );212 212 // $this->loader->add_filter( 'woocommerce_is_rest_api_request', $plugin_cart, 'simulate_as_not_rest', 10 ); 213 213 $this->loader->add_filter( 'woocommerce_persistent_cart_enabled', $plugin_cart, 'mobile_builder_woocommerce_persistent_cart_enabled' );
Note: See TracChangeset
for help on using the changeset viewer.