You are here

function uc_product_get_shipping_type in Ubercart 8.4

Same name and namespace in other branches
  1. 5 shipping/uc_quote/uc_quote.module \uc_product_get_shipping_type()
  2. 6.2 shipping/uc_quote/uc_quote.module \uc_product_get_shipping_type()
  3. 7.3 shipping/uc_quote/uc_quote.module \uc_product_get_shipping_type()

Gets a product's shipping type.

Parameters

$product: A product object.

Return value

string The product's shipping type, or the store's default shipping type if the product's is not set.

3 calls to uc_product_get_shipping_type()
NewPackageForm::buildForm in shipping/uc_fulfillment/src/Form/NewPackageForm.php
Form constructor.
PackageEditForm::buildForm in shipping/uc_fulfillment/src/Form/PackageEditForm.php
Form constructor.
uc_quote_assemble_quotes in shipping/uc_quote/uc_quote.pages.inc
Pulls the get_quote_from_* triggers and assembles their returned data.

File

shipping/uc_quote/uc_quote.module, line 347
The controller module for fulfillment modules that process physical goods.

Code

function uc_product_get_shipping_type($product) {
  $quote_config = \Drupal::config('uc_quote.settings');
  $shipping_type = $quote_config
    ->get('shipping_type');
  if ($product->nid->target_id && ($type = uc_quote_get_shipping_type('product', $product->nid->target_id))) {
    $shipping_type = $type;
  }
  return $shipping_type;
}