Plugin Directory

Changeset 2033514


Ignore:
Timestamp:
02/18/2019 05:16:07 PM (7 years ago)
Author:
nicolaspro14
Message:

1.2.1 release

Location:
clipr
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • clipr/trunk/clipr.php

    r2033312 r2033514  
    44Plugin Name: Clipr
    55Description: Mobile experience that converts. Connect your Woocommerce e-shop with Clipr platform now !
    6 Version: 1.2.0
     6Version: 1.2.1
    77Author: Clipr
    88Author URI: https://clipr.co
     
    1111*/
    1212
    13 define( 'CLIPR__VERSION',            '1.2.0' );
     13define( 'CLIPR__VERSION',            '1.2.1' );
    1414define( 'CLIPR__PLUGIN_DIR',         __DIR__ );
    1515define( 'CLIPR__PLUGIN_FILE',        __FILE__ );
  • clipr/trunk/inc/functions.cart-builder.php

    r1955385 r2033514  
    1111    global $woocommerce;
    1212
     13    $LOG_CHECKOUT = [];
     14
     15    $debug = true;
     16
    1317    // Call clipr for cart content
    1418    $response = clipr_curl("landing","/p/module/cart/".$cnv_cart_id."/",[],$env);
    1519    // $response = json_decode('{"success":true,"data":{"products":[{"idProduct":"10","idVariant":"19"}]}}',true); // for debugging purpose
    1620
     21    if ($debug) {
     22        $LOG_CHECKOUT['ENV'] = $env;
     23        $LOG_CHECKOUT['URL'] = "/p/module/cart/".$cnv_cart_id."/";
     24        $LOG_CHECKOUT['GET_CART_CONTENT'] = $response;
     25    }
    1726
    1827    if ($response != null && in_array("data",array_keys($response))) {
     
    2433        // $woocommerce->cart->empty_cart(); // Better keep old cart content here (especially for embedded clip)
    2534
    26 
    27 
    2835        // Add product to cart one by one
    2936        foreach ($products as $product) {
     
    3441            if ($idProduct == $idVariant) {
    3542                // No variant
    36                 $woocommerce->cart->add_to_cart($idProduct, 1);
     43                try {
     44                    $woocommerce->cart->add_to_cart($idProduct, 1);
     45                } catch (\Exception $e) {
     46                    if ($debug) {
     47                        $LOG_CHECKOUT['ERROR_ADD_CART_NO_VARIAT'] = $e->getMessage();
     48                    }
     49                }
    3750            } else {
    38                 $woocommerce->cart->add_to_cart($idProduct, 1, $idVariant);
     51                try {
     52                    $woocommerce->cart->add_to_cart($idProduct, 1, $idVariant);
     53                } catch (\Exception $e) {
     54                    if ($debug) {
     55                        $LOG_CHECKOUT['ERROR_ADD_CART_WITH_VARIANT'] = $e->getMessage();
     56                    }
     57                }
    3958            }
    4059        }
     60    }
     61
     62    if ($debug) {
     63        $LOG_CHECKOUT['REDIRECT_URL'] = $redirect_url;
     64        $LOG_CHECKOUT['CHECKOUT_URL'] = $woocommerce->cart->get_checkout_url();
     65        $LOG_CHECKOUT['CART_URL'] = $woocommerce->cart->get_cart_url();
     66        wp_send_json(['debug'=>true,'data'=>$LOG_CHECKOUT]);
    4167    }
    4268
  • clipr/trunk/readme.txt

    r2033312 r2033514  
    55Tested up to: 5.1
    66Requires PHP : 5.4
    7 Stable tag: 1.2.0
     7Stable tag: 1.2.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7777= 1.2.0 =
    7878* Wordpress 5.0 compatibility
     79
     80= 1.2.1 =
     81* Debug support
Note: See TracChangeset for help on using the changeset viewer.