Jump to content

Set 'Recurring Price' to 0 based on type of domain


DennisHermannsen

Recommended Posts

Hi,

We need to set the recurring price to 0 for domain transfers for the .dk TLD. When a client orders a transfer of this TLD, the client will not be billed by us, but instead by the DK Registry. It makes absolutely no sense to have a recurring price for it for us.
We can't just simply change the 'Renew/Register' price for the TLD as this price is actually used for domain registrations.

Does anyone know of a way to do this? I've tried with various hooks, but without any luck.

Link to comment
Share on other sites

Seems like I didn't do my research properly 😄

This seems to be doing some of what I want:

<?php
add_hook('OrderDomainPricingOverride', 1, function($vars) {
	$domainType = $vars['type'];
	$domainName = $vars['domain'];
	
	if($domainType = "transfer" AND strpos($domainName, '.dk') !== false){
		return ['recurringAmount' => 0];
	}
});

However: It doesn't calculate the correct price if I add another registration for a .dk domain. Any idea why?

Edited by DennisMidjord
Link to comment
Share on other sites

Guess who made a type in their code? 😛

Correcting my if statement seems to have solved my error:

<?php
add_hook('OrderDomainPricingOverride', 1, function($vars) {
    $domainType = $vars['type'];
    $domainName = $vars['domain'];

    if($domainType == "transfer" AND strpos($domainName, '.dk') !== false){
        return ['recurringAmount' => 1];
    }
});

<?php
add_hook('OrderDomainPricingOverride', 1, function($vars) {
	$domainType = $vars['type'];
	$domainName = $vars['domain'];

	if($domainType == "transfer" AND strpos($domainName, '.dk') !== false){
		return ['recurringAmount' => 1];
	}
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated