Inventory_Presser_WP_All_Import::set_availability_for_sale( int $post_id, SimpleXMLElement $xml_node, bool $is_update )


Description Description

Not all feed imports have a for sale/sold bit that matches up nicely with our Availability taxonomy. Mark vehicles as for sale if no relationship exists in the taxonomy.

Top ↑

Parameters Parameters


(int) (Required)


(SimpleXMLElement) (Required)


(bool) (Required)

Top ↑

Return Return


Top ↑

Source Source

File: includes/integrations/class-wp-all-import.php

	public function set_availability_for_sale( $post_id, $xml_node, $is_update ) {
		$taxonomy = 'availability';
		if ( ! empty( wp_get_object_terms( $post_id, $taxonomy ) ) ) {
			// There is already a relationship

		// Do we have a For Sale term?
		$term = get_term_by( 'slug', 'for-sale', $taxonomy );
		if ( $term ) {
			// Yes, create the relationship
			wp_set_object_terms( $post_id, $term->term_id, $taxonomy );