How can I add a voucher to my checkout that is not registered in magento2?

My situation is as follows: I use an apiRest that brings me vouchers. Example: 20% discount for the entire purchase.

But I cannot apply it to the till and it is reflected.

I found this link that tells me how to create a custom voucher, but I don't understand how to make it dynamic:
https://www.mageplaza.com/devdocs/how-add-custom-discount-magento-2.html

I also found this other link that I thought would be my solution, but it didn't really work for me:
https://webkul.com/blog/update-cart-totals-by-js-on-checkout-page-magento2/

Synatiq – KVM plans and special voucher for LEB available outside of London!

Synatiq contacted us with some KVM specials they advertise, along with a very interesting offer for LEB readers.
Only at their London location is a $ 50 credit available without an expiration date, which is valid after the first transaction or final payment using coupon code 50-ON-US. The lowest acceptable transaction is $ 5 and the $ 50 can be redeemed.
Once registered, use voucher code 50-ON-US from Billing – add credit after a successful transaction (from USD 5). The free credits are not limited in time and only expire when they are used.
* The voucher can be discontinued at any time for new registrations.

Synatiq is confident that there is no other cloud VPS provider offering 10 Gbps KVM VPS with free backups and NVMe storage on a $ 5 server. They are happy to present you with such a plan.

The free packages also include DDoS protection, Windows license and weekly backups.

Your WHOIS is public and you can find your ToS / Legal Docs here. They accept PCredit cards, PayPal, BitCoin and UK bank transfers as payment methods.

Here's what they had to say:

“Synatiq is a British company that offers extremely fast, extremely reliable, secure and immediately usable Linux and Windows cloud servers (VPS). Based on pure NVMe storage, standard 10 GB / s, DDoS protection, instant setup and free weekly backups. "

Here are the offers:

Package 1

  • 1024 MB RAM
  • 1024 MB swap
  • 1x vCPU
  • 25 GB SSD storage space
  • 1000 GB transfer
  • 10 Gbit / s uplink
  • 1x IPv4
  • Linux & Windows
  • KVM
  • $ 5 / month or $ 50 / year (2 free months)
  • (TO ORDER)

Package 2

  • 2048 MB RAM
  • 2048 MB swap
  • 2x vCPU
  • 50 GB SSD storage space
  • 2000 GB transfer
  • 10 Gbit / s uplink
  • 1x IPv4
  • Linux & Windows
  • KVM
  • $ 10 / month or $ 100 / year (2 free months)
  • (TO ORDER)

NETWORK INFORMATION:

UK Servers Limited – Great Britain, London

Test IPv4: 94.229.65.150

Test IPv6: 2a01: a500: 3 :: 2a01

Test file: http://94.229.65.150/test1G.bin


Host node specifications:

– 2 x Intel 10 Core Xeon 4114 CPUs

– 128 GB DDR4 ECC RAM

– 8 x 1 TB NVMe drives

– Hardware RAID10

– 10 Gbit / s uplink

Please let us know if you have any questions / comments and have fun!

plugins – How to use a non-existent voucher in Woocommerce

I use this code, this works perfectly until checkout.

function royal_woocommerce_filter_checkout_for_coupons( $subtotal, $compound, $cart ) {

    // Your logic to get store credit value for a user will go here
    $store_credit = 50;

    // We only need to add a store credit coupon if they have store credit
    if($store_credit > 0){

        // Setup our virtual coupon
        $coupon_name = 'store-credit';
        $coupon = array($coupon_name => $store_credit);

        // Apply the store credit coupon to the cart & update totals
        $cart->applied_coupons = array($coupon_name);
        $cart->set_discount_total($store_credit);

        $cart->set_total( $cart->get_subtotal() - $store_credit + wc()->cart->get_shipping_total() );
        $cart->coupon_discount_totals = $coupon;
    }

    return $subtotal;
}

add_filter( 'woocommerce_cart_subtotal', 'royal_woocommerce_filter_checkout_for_coupons', 10, 3 );

However, when we pay, the voucher is automatically removed from the shopping cart.
Please help me what I am missing.

35% OFF THE VOUCHER – from £ 9.75 / year (UK and US servers) cPanel / FREE SSL / SSD / Unlimited bandwidth

ENCRYPT FREE SSL CERTIFICATES / SUPER FAST CLOUDLINUX SERVER IN THE UK AND USA / ON CPANEL

PLEASE FEEL FREE TO CONTACT LIVE CHAT ON OUR WEBSITE

Inexpensive web hosting offers some of the most reliable hosting plans in the UK and US. Our servers are located in the UK and US and we offer a variety of offers at discounted prices

We currently have 1 x UK server and 1 x US server to choose from – 1 x London / 1 x New York

Please use coupon code – 35OFF for your 35% DISCOUNT

* Our main packages *

* Mini plan *

SSD space – 1 GB
Bandwidth – Unlimited
Hosted websites – 2
Subdomains – 5th
Email accounts – 100
Control Panel – cPanel
Regular annual price – £ 15 – 35% off with coupon 35OFF = £ 9.75

Click Here to Order – London, UK

Click Here to Order – New York, USA

* Basic plan *

SSD storage space – 2 GB
Bandwidth – Unlimited
Hosted websites – 3
Subdomains – 5th
Email accounts – 100
Control Panel – cPanel
Regular annual price – £ 20 – 35% off with coupon 35OFF = £ 13

Click Here to Order – London, UK

Click Here to Order – New York, USA

* Standard plan *

SSD storage space – 5 GB
Bandwidth – Unlimited
Hosted websites – 5
Subdomains – 30
Email accounts – unlimited
Control Panel – cPanel
Regular annual price – £ 30 – 35% off with voucher 35OFF = £ 19.50

Click Here to Order – London, UK

Click Here to Order – New York, USA

* Business Plan *

SSD storage space – 10 GB
Bandwidth – Unlimited
Hosted websites – unlimited
Subdomains – Unlimited
Email accounts – unlimited
Control Panel – cPanel
Regular annual price – £ 66- 35% off with coupon 35OFF = £ 42.90

Click Here to Order – London, UK

Click Here to Order – New York, USA

What's in the box?
– 99.99% or more availability of your website
– No hidden fees during the ordering process
– Set up 5 minutes after receipt of payment
– 30 days money back, no questions asked
– Professional support
– 24/7 network and service monitoring
– Fast, reliable and current servers

USE THE COUPON CODE 35OFF TO GET 35% OFF ONCE

Check out our hosting plans at https://www.cheapwebhosting-uk.co.uk/hosting/

Custom plans can be created. For more information please send an email to info [@] cheapwebhosting-uk.co.uk.

magento2 – Magento 2: Discount voucher works ONLY on the checkout page

I have Magento 2.3.3 and found that the discount code on the checkout page does not work.
The strange thing is that it works on the shopping cart page, but it just doesn't matter at checkout.

On top of that, The buttons don't even have the text, To click the right button, I had to examine the element to see which was the cancel and which was the apply.

Here is a screenshot

Enter image description here

How can I fix it? Any suggestions?

Thanks a lot!

magento 1.9 – Change voucher discount calculation

I am new to Magento and if someone can bring light to me, is there any way to override the calculation method when applying a discount?

Magician Version 1.9.4,

The problem is, for example, how the magician calculates the product price exl. VAT and apply VAT after deduction of a discount

//We have this rounding in Mage.
function roundPrice($price){
    return round($price, 2);
}

$productPrice = 61.67;
$qty = 2;
$discount = 25; //25%

$subTotal = roundPrice($productPrice * $qty);

$discount = roundPrice($productPrice - ($productPrice / 100) * $discount);

var_dump($subTotal - 30.84 (Fixed discount amount)); // Result float(92.5)

var_dump($discount); // Result float(92.51) I need to get this one cent instead of mage default calculation from convert percent into fixed 

BitVPS – VPS offer with voucher code especially for LEB! $ 8.29 / month

BitVPS has jumped onto our radar with an interesting offer that they are expanding to the LEB community. What they told us is that BitVPS is very different from your ordinary VPS host. You don't need any information to get started, they offer completely anonymous and account-free VPS. You do not need to log in or register to get started. Simply select your server, pay with the cryptocurrency you selected and your server will be provided immediately.

You have provided a coupon code for the offer below. The order link below leads to their full page with a variety of plans, but the specifically listed one is called s-1vcpu-1gb.

As always, we encourage our readers to share their thoughts in the comment section.

You can find your terms and conditions / legal documents here. You accept Bitcoin, Bitcoin SV, Bitcoin Cash, Litecoin, Ethereum, Dash, Pivx, Zcash, Ripple, Digibyte, Qtum, Monero and Tether as payment methods.

Here is the offer:

VPS offer

  • 1024 MB RAM
  • 1x vCPU
  • 25 GB SSD
  • 1 TB transmission
  • 1 Gbps uplink
  • 1x IPv4
  • 1x IPv6
  • KVM
  • Coupon code: LEBEXCLUSIVE
  • $ 8.29 / month
  • [TO ORDER]

NETWORK INFORMATION:

New York, New York, USA

Test IPv4: 45.55.37.238

Test file: http://speedtest-nyc1.digitalocean.com/100mb.test


Host node specifications:

– Intel Xeon dual-hex core processors

– 64 GB RAM

– 8 x 2 TB SSDs

– 1 Gbps uplink

Please let us know if you have any questions / comments and have fun!

Terminology – What is a flight ticket voucher?

When buying a return ticket, a single ticket and a single PNR will be issued. But I've heard that you can cancel a single leg of this outward and return journey.
How is that possible? They told me that these tickets have two "coupons" and they cancel the coupon instead of the ticket.
I would be glad if someone gives me an indication of this concept or explains it to me