Plugin Directory

Changeset 2862914


Ignore:
Timestamp:
02/09/2023 06:59:02 PM (3 years ago)
Author:
viaads
Message:

Stability Update

Location:
viaads
Files:
16 added
4 edited

Legend:

Unmodified
Added
Removed
  • viaads/trunk/hooks/orderHooks.php

    r2858930 r2862914  
    55use DateTime;
    66use Exception;
     7use WC_Tax;
    78
    89defined( 'ABSPATH' ) || exit;
     
    3334        // Currency
    3435        $order_object->Currency = $order->get_currency();
     36
     37        // Vat Percentage
     38        $vat_percentage = floatval('0.25');
     39        foreach($order->get_items('tax') as $item_id => $item ) {
     40            $tax_rate_id    = $item->get_rate_id(); // Tax rate ID
     41            $tax_percent    = WC_Tax::get_rate_percent( $tax_rate_id ); // Tax percentage
     42            $vat_percentage       = floatval("0." . str_replace('%', '', $tax_percent)); // Tax rate
     43        }
     44
     45        $order_object->vat_percentage = $vat_percentage;
     46
    3547        // Last Modified
    3648        $lastModifiedGmt = new DateTime($order->get_date_modified());
  • viaads/trunk/readme.txt

    r2859216 r2862914  
    44Requires at least: 5.4
    55Tested up to: 6.1
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.1
    77Requires PHP: 7.0
    88License: GPLv3
  • viaads/trunk/sync.php

    r2858930 r2862914  
    88use Exception;
    99use WC_Product_Factory;
     10use WC_Tax;
    1011
    1112defined('ABSPATH') || exit;
     
    3637                print_r(ViaAds_PostToUrl("https://integration.viaads.dk/woocommerce/WebShopData", $webshop, true));
    3738            } else {
    38                 ViaAds_PostToUrl("https://integration.viaads.dk/woocommerce/WebShopData", $webshop, true);
     39                //Split array in chucks for max data size
     40                $splitted = array_chunk($webshop->Products, 2500);
     41                foreach ($splitted as $interval) {
     42                    $webshop->Products = $interval;
     43                    ViaAds_PostToUrl("https://integration.viaads.dk/woocommerce/WebShopData", $webshop, true);
     44                    $webshop->Categories = [];
     45                }
    3946            }
    4047        } else if ($_GET['event'] == "orders") {
     
    339346            // Currency
    340347            $order_object->Currency = $order->get_currency();
     348            // Vat Percentage
     349            $vat_percentage = floatval('0.25');
     350            foreach($order->get_items('tax') as $item_id => $item ) {
     351                $tax_rate_id    = $item->get_rate_id(); // Tax rate ID
     352                $tax_percent    = WC_Tax::get_rate_percent( $tax_rate_id ); // Tax percentage
     353                $vat_percentage       = floatval("0." . str_replace('%', '', $tax_percent)); // Tax rate
     354            }
     355
     356            $order_object->vat_percentage = $vat_percentage;
     357
    341358
    342359            // Last Modified
  • viaads/trunk/viaads.php

    r2859216 r2862914  
    33 * Plugin Name: ViaAds
    44 * Description: Plugin der muliggør forbindelsen til ViaAds / Plug-in enabling the connection to ViaAds.
    5  * Version: 1.1.0
     5 * Version: 1.1.1
    66 * Author: ViaAds
    77 * Author URI: https://www.viaads.dk/
Note: See TracChangeset for help on using the changeset viewer.