Skip to content

Commit

Permalink
WC checkout improvement allow multi products comma seperated product …
Browse files Browse the repository at this point in the history
…ID's
  • Loading branch information
RensTillmann committed Oct 31, 2019
1 parent da24f9f commit 3ca83ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/add-ons/super-forms-woocommerce/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Oct 31, 2019 - Version 1.5.30
- Improved: When a field value contains comma seperated product ID's add all of them into the cart/checkout

Jun 14, 2019 - Version 1.5.2
- Compliance: Working towards Envato WordPress Requirements Badge/Compliance
- Escaping all Translatable strings
Expand Down
31 changes: 18 additions & 13 deletions src/add-ons/super-forms-woocommerce/super-forms-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Super Forms - WooCommerce Checkout
* Plugin URI: http://codecanyon.net/item/super-forms-drag-drop-form-builder/13979866
* Description: Checkout with WooCommerce after form submission. Charge users for registering or posting content.
* Version: 1.5.20
* Version: 1.5.30
* Author: feeling4design
* Author URI: http://codecanyon.net/user/feeling4design
* Text Domain: super-forms
Expand All @@ -38,7 +38,7 @@ final class SUPER_WooCommerce {
*
* @since 1.0.0
*/
public $version = '1.5.20';
public $version = '1.5.30';


/**
Expand Down Expand Up @@ -956,21 +956,26 @@ public static function before_email_success_msg( $atts ) {
if( isset( $product[1] ) ) $product_quantity = SUPER_Common::email_tags( $product[1], $data, $settings );
if( isset( $product[2] ) ) $product_variation_id = SUPER_Common::email_tags( $product[2], $data, $settings );
if( isset( $product[3] ) ) $product_price = SUPER_Common::email_tags( $product[3], $data, $settings );

$product_price = self::tofloat($product_price);
$product_quantity = absint($product_quantity);
if( $product_quantity>0 ) {
$product_id = absint($product_id);
$meta = array();
if( isset($products_meta[$product_id]) ) {
$meta = $products_meta[$product_id];
// Check if multiple ideas found (seperate by comma)
$multi_products = explode(',', $product_id);
foreach( $multi_products as $product_id ) {
$product_id = absint($product_id);
$meta = array();
if( isset($products_meta[$product_id]) ) {
$meta = $products_meta[$product_id];
}
$products[] = array(
'id' => $product_id,
'quantity' => $product_quantity,
'variation_id' => absint($product_variation_id),
'price' => $product_price,
'super_data' => $meta
);
}
$products[] = array(
'id' => $product_id,
'quantity' => $product_quantity,
'variation_id' => absint($product_variation_id),
'price' => $product_price,
'super_data' => $meta
);

}
}
Expand Down

0 comments on commit 3ca83ce

Please sign in to comment.