1

How can I check if the cart has any shippable product in Ubercart 3 for Drupal 8? Previous version had uc_cart_is_shippable() method which Drupal 8 module does not seem to have by default.

Is there a separate/additional module to get this function working? Or how else can I check if the cart has a shippable product?

1 Answer 1

1

The function is now a part of the CartInterface and implemented in the Cart::isShippable() method. You can use the CartManager service to retrieve the Cart object and call the method:

\Drupal::service('uc_cart.manager')->get()->isShippable()
2
  • Thanks @Shawn Conn Commented Mar 30, 2019 at 20:37
  • do we have the equivalent function for uc_cart_product_is_shippable() as well? Commented Mar 31, 2019 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.