0 Replies - 94 Views - Last Post: 06 March 2015 - 05:43 PM

#1 fancycode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-February 15

wordpress plugin issue

Posted 06 March 2015 - 05:43 PM

Could I ask the wordpress plugin issue here?

I would like to know how to apply the Order Again option for Variable product to show product info correctly when using this plugin:HRER .

The issue is that whenever user(on My account page>>view a specific order with Variable product) use the Order Again option for the order of Variable product that was purchased before, the order made with Order Again option just shows the product name and sku on shopping cart, email order confirmation, order page on dashboard, without considering if there are info from variable option info on that variable product's page... Could it be exactly like the order purchased for first time to show the variable option info?


I am not sure if this is the plugin issue or caused by the theme itself: Here
sorry for my unclear description and I have tried to find the answer myself and it may has something to do with the file called class-wc-form-handler inside this plugin and below is about that Option code on the file

The theme does not provide assistant anymore...what a pity..
Pls help and appreciate anyone who could help...Thank you every much

/**
* Place a previous order again.
*/
public static function order_again() {

// Nothing to do
if ( ! isset( $_GET['order_again'] ) || ! is_user_logged_in() || ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'woocommerce-order_again' ) ) {
return;
}

// Clear current cart
WC()->cart->empty_cart();

// Load the previous order - Stop if the order does not exist
$order = wc_get_order( absint( $_GET['order_again'] ) );

if ( empty( $order->id ) ) {
return;
}

if ( ! $order->has_status( 'completed' ) ) {
return;
}

// Make sure the user is allowed to order again. By default it check if the
// previous order belonged to the current user.
if ( ! current_user_can( 'order_again', $order->id ) ) {
return;
}

// Copy products from the order to the cart
foreach ( $order->get_items() as $item ) {
// Load all product info including variation data
$product_id = (int) apply_filters( 'woocommerce_add_to_cart_product_id', $item['product_id'] );
$quantity = (int) $item['qty'];
$variation_id = (int) $item['variation_id'];
$variations = array();
$cart_item_data = apply_filters( 'woocommerce_order_again_cart_item_data', array(), $item, $order );

foreach ( $item['item_meta'] as $meta_name => $meta_value ) {
if ( taxonomy_is_product_attribute( $meta_name ) ) {
$variations[ $meta_name ] = $meta_value[0];
} elseif ( meta_is_product_attribute( $meta_name, $meta_value, $product_id ) ) {
$variations[ $meta_name ] = $meta_value[0];
}
}

Attached image(s)

  • Attached Image
  • Attached Image


Is This A Good Question/Topic? 0
  • +

Page 1 of 1