Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Ameliabooking_Helpers::get_coupon_services( int $coupon_id )

Fetches the coupon services with service ID.


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$coupon_id

(Required) The coupon ID.


Top ↑

Return Return

(string) The services associated with the coupon. Separated by comma.


Source Source

File: src/integrations/ameliabooking/helpers/ameliabooking-helpers.php

	public function get_coupon_services( $coupon_id ) {
		global $wpdb;
		$results = $wpdb->get_results(
			$wpdb->prepare(
				"SELECT name FROM {$wpdb->prefix}amelia_coupons_to_events as coupons
					INNER JOIN {$wpdb->prefix}amelia_services as services 
					ON coupons.eventId = services.id
					WHERE couponId = %d",
				$coupon_id
			),
			ARRAY_A
		);
		return implode( ', ', array_column( $results, 'name' ) );
	}