Customizing Appointments+ buttons and wording

Is there a way to customize the text for booking appointments? For example, the price is listed as "xx USD". It'd be great to just show "$xx.xx". The clientele on my site are localized to the US, and I don't see there being any variations for this.

I'm using the shortcode [app_paypal] to show the payment button. Is there a way that I could add some text above the button. This text would appear only when the payment button appears.

  • Jack Kitterhing

    Hi there @NWTD,

    Hope you're well today and thanks for your question.

    I do have a idea with the first option, if all your appointments are a set price, we could actually change this with the network wide text change in Ultimate Branding, if this makes sense, rather than making a core edit to the plugin? :slight_smile:

    For the text above the payment button, this should be possible, you're just looking to echo some text above the button correct? Once the appointment has been booked, then the payment shows? Is that going to be the same text across the network?

    Thanks!

    Kind Regards
    Jack.

  • Hoang Ngo

    Hi @NWTD,

    I hope you're well today.

    Here is the custom code for you. The code only work if current currency is USD.

    if ( class_exists( 'Appointments' ) ) {
    	add_filter( 'app_confirmation_price', 'appointments_replace_usd_by_symbol', 10, 1 );
    	function appointments_replace_usd_by_symbol( $price_text ) {
    		if ( stristr( $price_text, 'usd' ) ) {
    			$tmp_price = trim( str_replace( 'usd', '', strtolower( $price_text ) ) );
    			return '$' . $tmp_price;
    		}
    		return $price_text;
    	}
    
    	add_filter( 'app_paypal_additional_fields', 'appointments_pre_paypal', 10, 1 );
    	function appointments_pre_paypal( $form ) {
    		//parse the form html
    		$dom = new DOMDocument();
    		$dom->loadHTML( $form );
    		$xp    = new DOMXpath( $dom );
    		$nodes = $xp->query( '//input[@name="currency_code"]' );
    		if ( count( $nodes->length ) ) {
    			$node     = $nodes->item( 0 );
    			$currency = $node->getAttribute( 'value' );
    			if ( strtolower( $currency ) == 'usd' ) {
    				//return the custom text here
    				$custom_text = 'YOUR CUSTOM TEXT HERE';
    				return $custom_text . $form;
    			}
    		}
    		return $form;
    	}
    }

    Please replace the "YOUR CUSTOM TEXT HERE" with your text, and this will display before the paypal button :slight_smile:

    If you have any issues please don't hesitate to let us know so we can assist

    Best Regards
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.